hylo icon indicating copy to clipboard operation
hylo copied to clipboard

Implement '@autoclosure'

Open kyouko-taiga opened this issue 1 year ago • 1 comments

The feature should work similarly as it does in Swift.

Note: @autoclosure is necessary to properly implement shortcut behavior in Bool.infix&&

kyouko-taiga avatar Sep 27 '23 14:09 kyouko-taiga

This issue can be split into several steps:

  1. Implement syntactic support for parameter attributes, including @autoclosure
  2. Make sure that @autoclosure attributes have a type [E]() -> T
  3. Let the type inferrer accept arguments of type T to be passed to parameters of type [E]() -> T
  4. Synthesize the construction of a lambda when an argument is passed to an @autoclosure parameter at the IR level

We might have to discuss whether auto closures are allowed to be mutating. We may also want sugar for the declaration of their environment E.

kyouko-taiga avatar Oct 09 '23 14:10 kyouko-taiga