

Ask HN: Which languages use method.object() order? - pbowyer

I read http:&#x2F;&#x2F;verraes.net&#x2F;2014&#x2F;09&#x2F;objects-as-contracts-for-behaviour&#x2F; today and liked his idea of putting method calls before the object.<p>So rather than write &#x27;invoice.pay(anAmount&#x27;) or &#x27;appointment.reschedule(aDate)&#x27; you would write &#x27;pay.invoice(anAmount)&#x27; and &#x27;reschedule.appointment(aDate)&#x27;<p>Are there any programming languages which allow this? Has it been tried and failed?
======
RodgerTheGreat
An obvious inconvenient side-effect of this approach would be that if
expressions are still typed left-to-right it would be very difficult to
provide the kind of tab-completion that is common in IDEs and text editors,
since the information necessary to narrow the range of a search only becomes
available as you finish the expression.

------
bjourne
Polymorphic functions exist in many languages: pay(invoice, anAmount),
reschedule(appointment, aDate). Lisp, Scheme, Haskell, Erlang.. They all can
do that. If the function can dispatch on the first parameter given, they
become equivalent to the object oriented syntax. But many languages go one
step further and let you dispatch on any of the arguments, or a combination of
them and so on.

