- What is your evaluation of the proposal?
I support this proposal and think that it's scoped properly as it is. The single-expression rule will allow most cases that should be allowed, forbid most cases that should be forbidden, and—importantly—not feel as arbitrary as restricting this syntax to certain declarations would. Part of what makes the current design chafe is that it's so obviously an arbitrary rule; single-expression everywhere would feel much more fair and principled.
I also think that this is the kind of proposal that Evolution is prone to overthinking. I suspect that in practice, even people who feel in the abstract that uses in certain contexts might confuse them won't actually find them confusing when they encounter them in the wild. If accepted without revision, I really think that in a year most users will think this change was an unqualified improvement over the status quo.
(The one place where I might deviate from the proposal is in initializers—init?() { nil }
reads strangely because you're not really expecting an initializer to return a value at all. On the other hand, if we ever get factory initializers, we'll probably want them to support single-expression implicit return, so it might be better to let that one slide.)
- Is the problem being addressed significant enough to warrant a change to Swift?
Yes. This is a tiny but very frequent annoyance; in aggregate, it's well worth addressing.
- Does this proposal fit well with the feel and direction of Swift?
Yes. There's a direct analogy to the equivalent closure feature and Swift includes other shorthands for very short declarations, like implicit get
in accessor blocks.
- If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
I've used several languages like Ruby and Perl where everything is an expression. I don't favor that approach because you often don't realize what you're returning; I especially hated the Ruby style rule discouraging explicit return
unless you were returning early. I think this proposal strikes the right balance between clarity and brevity.
- How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
Just a glance at the final proposal, but I read the pitch more closely.