effekt icon indicating copy to clipboard operation
effekt copied to clipboard

Automatic eta expansion of block arguments

Open b-studios opened this issue 4 years ago • 0 comments

Currently, block arguments always have to be fully applied:

map([1, 2, 3]) { a => f(a) }

Instead, we could also support

map([1, 2, 3]) { f }

which could desugar to the above version.

Similarly, we could allow partial application:

f: (Int)(Int) -> T
map([1, 2, 3]) { f(1) }

desugaring to

map([1, 2, 3]) { x=> f(1)(x) }

The desugaring is type directed and should always lead to fully applied blocks. This is necessary to eventually adapt capabilities.

There are multiple possible designs to where the desugaring can take place. Since it is type directed, we further need to investigate interaction with overload resolution.

b-studios avatar Apr 16 '20 19:04 b-studios