11 ms·
Object.method() doesn't really make sense due to multiple dispatch, I think.
by termain 12y ago
Object.method() doesn't really make sense due to multiple dispatch, I think.
- RivieraKid 12y agoWhy? It can be just a syntactic sugar for method(object).
- ovis 12y agoI think the point is that it special-cases the first object, at least in the syntax. You _could_ write it that way, but since the method is chosen based on all the object types, it doesn't make much sense to do so.
- RivieraKid 12y agoThe point was that object.method() is sometimes more readable. For example I find web_socket_manager.reconnect_if_needed() more readable than reconnect_if_needed(web_socket_manager).
- deleted 12y ago[deleted]
- infinite8s 12y agoThat's because you are used to thinking in terms of objects, whereas in Julia the focus is on data and operations on data (the two are often conflated but they aren't the same).
- RivieraKid 12y agoI think in both depending on the situation.
- Someone 12y agoOne could have a language where object.method(args) does single dispatch on "defined in a class" methods while method(object, object,...) does multiple dispatch on generic methods. That could get really confusing for the language's users, though, if there were name clashes between the two, and they would be there in any reasonably large program. And of course, argument order already gives the first and last arguments special attention. Another way to diminish that special-casing is going to the extreme other end: object.object.object.method(). Remove the now superfluous parentheses and replace the periods by spaces and you end up with Forth.
- deleted 12y ago[deleted]
- orbifold 12y agoHm, well it sort of does make sense if you have tuples, it would be just (object_1,...,object_n).method