And finally this enhancement as well has come from this discussion:
@seancorfield This one is based on what we discussed as
SomeClass::.instanceMethod – treating such unbound Java instance method reference
We analyzed the syntax as well as how some other dynamic languages and even JS frameworks handle this sort of thing. In the end
- Since “member methods” in CF/BL are more of a loose concept, and can be member methods on a java class, or “magic” member methods from CF/BL types like
numeric
orarray
, the class name didn’t really work in all scenarios, so we simplified the syntax to simply.methodName
- instead of
::.
we went with just a period in front of the construct to look like a headless method call which is a bit more readable. - I’m not sure about Clojure, but java’s
String::concat
method binding doesn’t allow args to be specified. We are also allowing.methodName( arg )
to include arg(s) along with the member method binding.
pendingOrders.each( .submit )
or
[ "brad", "luis", "jon" ].map( .left( 1 ) ); // [ "b", "l", "j" ]
There are more examples in the linked thread, and even more examples on the ticket.