So, if we step away from functional language for a...
# language-proposals
o
So, if we step away from functional language for a moment, and say that we are not doing “partial application” (we are always doing complete applications, before we ship to customers!), then we are still talking about “bound function references”, only that we can bind any parameter, not just a receiver. And a syntax is this:
receiver::f(_, _, value, _, complex.expression())
, or with the use of named arguments
receiver::f(paramName = value)
. I don’t see a good syntax for unbound receiver though, because
::f
is already reserved for functions without receivers.
👍 3
r
Would it make sense to have something like
_::f(all, the, bindings)
?
i
Currently to get a function reference with unbound receiver we have to specify the receiver type:
ReceiverType::f
r
Ah, indeed
o
which is verbose, no? 🙂
i
Somehow we need to know where to search that
f
, if it is a member or extension function. However probably that could be inferred from usage.
o
I think we can tolerate the typename requirement
🆗 1
i
for example:
strings.map(_::toUpper)
instead of
strings.map(String::toUpper)
, but not
val f = _::toUpper
o
_
is for unused, it is not unused here
i
_
is for unused in parameter lists. However, there was a related proposal to use
_
as default value in argument lists