Allowing the object.method(args...) syntax as an alias for method(object, args ...)

I love the progress we’re making. :smiley:

To summarize, the current proposal is an infix operator -- (“dash”) defined as

--(obj, meth) = (args...; kwargs...) -> meth(obj, args...; kwargs...)

which has tighter binding than function calls, and has right-associativity.

We have found that this operator will satisfy the desire to chain operations on an object threaded as a first argument through a sequence of methods,

my_object--meth1(args1...)--meth2(args2...)--meth3(args3...) ==
    meth3(meth2(meth1(my_object, args1...), args2...), args3...)

And, as a happy surprise, it also works well for chaining functions whose first argument is a function

[1,2,3]--iseven--filter()--sqrt--map() ==
    map(sqrt, filter(iseven, [1,2,3]))

This is a much better operator than expected.

Oh, and as a weird bonus, you can also evaluate expressions in Reverse Polish Notation:

3 -- 4 -- -() -- 5 -- +() == 5 + (4 - 3)

The things to work out, it seems, are:

  • confirm that we understand it correctly
  • check how difficult it would be to implement in the language
  • check that broadcasting would work, e.g. [1, 2, 3]--iseven.() == iseven.([1, 2, 3])

Thoughts? :thought_balloon: