second-bridge icon indicating copy to clipboard operation
second-bridge copied to clipboard

Thunks syntax/custom operator

Open jdesiloniz opened this issue 8 years ago • 1 comments

In Scala, thunks are represented by the : => syntax, encapsulating a function that takes no parameters and return a value; to achieve lazy input parameters in functions. It would be nice to use custom operators to create thunks easily, so we can have parameters by name in Swift too.

jdesiloniz avatar Oct 06 '15 09:10 jdesiloniz

To add later:

prefix operator => {}

prefix func =><T>(op: T) -> (() -> T) { return { () -> T in return op } }

jdesiloniz avatar Oct 07 '15 09:10 jdesiloniz