[swift-evolution] Control Flow Expressions

Per Melin p at greendale.se
Sun Dec 6 14:17:54 CST 2015


On Sat, Dec 5, 2015 at 7:15 PM, Chris Lattner <clattner at apple.com> wrote:

> Further, it is important to consider whether the code written using this
> will actually be *better* than the code written with these things as
> statements.  For example, the “switch” blocks tend to be very large, and
> turning them into expressions encourages additional indentation.


If you give functions implicit return at the same time – as in Haskell,
Erlang, Scala, Rust, Ruby, Lisp/Scheme/Clojure, etc –  there would be no
need for additional indentation half of the time.

I really, really like it in many of the mentioned languages, but I expect
that the C crowd will vehemently disagree. And maybe Swift is sufficiently
different from those languages that it makes less sense here. For example,
regardless of project, my average function body size in Erlang hovers
around two lines. Not even Slava Pestov would factor Swift that
aggressively.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151206/97e28d5f/attachment.html>


More information about the swift-evolution mailing list