koka-lang / koka

Koka language compiler and interpreter
http://koka-lang.org
Other
3.16k stars 151 forks source link

Create an overload for function fields to directly call the function #549

Open TimWhiting opened 3 weeks ago

TimWhiting commented 3 weeks ago

Generates another function to access and directly call a function field of a type.

This gets rid of the weird mystruct.func()() when getting and then directly calling a function.

I still generate the plain accessors with a locally qualified prefix thetype/get/function-field, and generate the caller with the locally qualified prefix typetype/call/function-field, this way for no-arg functions you can use mystruct.call/func() when the result type doesn't disambiguate.