SE-0279: Multiple Trailing Closures

Can this really work with label-less parameters? The line "UILabel(frame: someFrame)" is already valid as the first statement of a closure. Not until the following "update: {" line would the parser be able to backtrack and figure out that this is an argument list.


I think this is also confusing with loop labels. Consider that this is valid syntax today:

with {
  UILabel(frame: someFrame)
  update: while true {
    ...
  }
}

And if we ever decide to make the if/else statement an expression, it'd make this valid syntax too:

with {
  UILabel(frame: someFrame)
  update: if true {
    ...
  }
}

Except now it's syntax for an argument list (because you can't have a loop label preceding an if).

1 Like