SE-0255: Implicit Returns from Single-Expression Functions

Proposal Accepted

The review demonstrated clear support for this syntax for property and subscript getters, where the need to return simple single expressions is common.

On eliding the return from functions, the review feedback was more divided. While there was support from some reviewers, others expressed the view that the feature should be restricted to just getters. However, on reviewing the feedback, the core team does not see a strong case was made against applying it to functions as well, when weighed against the benefits of a single uniform rule.

Some reviewers floated the idea of a different syntax for function declaration, using = or => , as seen in other languages. The core team doesn't feel this syntax handles properties or subscripts well, and does not consider sugaring function declarations specifically with a separate syntax a useful change.

The core team also acknowledges that accepting this feature may encourage follow-on proposals that generalize it further, such as converting if/ switch statements into expressions, or allowing elision in multi-statement bodies. Accepting this proposal doesn't necessarily endorse or rule out those future directions.

Thank you to everyone who participated in this review!

Ben Cohen
Review Manager