5 ms·
> I'm not sure I understand you. `is_blocked(user, other_user)` seems like it’s still object-oriented to me. In OO, the object exposes what services it offers.
by TomSwirly 6y ago
> I'm not sure I understand you. `is_blocked(user, other_user)`
seems like it’s still object-oriented to me.
In OO, the object exposes what services it offers.
But in your code fragment, there is no way for a new implementation of `user` to override `is_blocked` - in most languages.
(C++ has ADL/Koenig resolution https://en.wikipedia.org/wiki/Argument-dependent_name_lookup https://en.wikipedia.org/wiki/Argument-dependent_name_lookup which actually does let you do this generically at compile time.)
- dragonwriter 6y ago> In OO, the object exposes what services it offers. In modular, especially statically typed, functional programming, modules identify what services they offer, and what data items those services consume, and the concerns of specification of data types and provision of services are decoupled.
- nybble41 6y ago> in most languages I'm pretty sure the language being referenced was Common Lisp, which supports multiple dispatch (in CLOS). In a multiple-dispatch OOP system methods can be specialized based on any argument—this is somewhat like ADL in C++ but more generalized. Ergo, a new implementation of 'user' can override or extend more generic versions of 'is_blocked'.