Conversation started Oct 25, 2016 at 15:26.
Oct 25, 2016 15:26
@jrh RE Verb(noun) vs. noun.Verb() – There is no real need for a syntactical distinction, e.g. Julia allows the former syntax, but it also uses multi-methods, which is a bit unusual. The whole verb vs noun distinction is only useful for OOP as a design approach, not for OOP as a concept or implementation technique.
The dot-notation becomes immediately obvious when you implement vtable-based OOP yourself in C. A vtable is a struct of function pointers. To call a method, you access the function pointer in the vtable struct, then also pass the object as invocant/this-parameter.
I've implemented an example here. Of course that uses a lot of dereferencing access "->" instead of normal struct access ".", but that's just C for you. In C++, object pointers are rarely used – objects usually are either references which allow method calls with ".", or are values that do not support polymorphic calls since their exact type is known at compile time.
@amon I about pinged you when jrh was asking that yesterday as it felt like the exact thing which would peak your interest ;-)
Some later languages use "->" for method calls (Perl, PHP); most prefer dot notation (Java, C#, nearly everything else). Exceptions (well, actually they predate C++) are Smalltalk which uses juxtaposition ("object method", "object method: arg", "object everything: is named: arg"). And Objective-C, which uses the circumfix operator [] as in [object method], but is otherwise Smalltalk-like
@jrh Unless you use polymorphism (and most code doesn't use polymorphism), OOP as used by most programmers is 100% a namespace management technique. Method calls are effectively a macro that substitutes a.b(...) with typeof(a)_b(a, ...)
@enderland Yes, please ping me for programming language stuff. I tend to read the transcript, and I tend to be asleep when such interesting discussions happen in another timezone, but such notifications are always appreciated.
 
Conversation ended Oct 25, 2016 at 15:37.