[swift-evolution] Control Flow Expressions
Chris Lattner
clattner at apple.com
Sun Dec 6 16:56:09 CST 2015
> On Dec 6, 2015, at 12:17 PM, Per Melin <p at greendale.se> wrote:
>
> On Sat, Dec 5, 2015 at 7:15 PM, Chris Lattner <clattner at apple.com <mailto: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.
This isn’t something that I’m personally interested in. I think that it is *feature* of swift that statements an declarations start with keywords. This greatly simplifies the grammar in various ways, and allows declmodifiers to be introduced without taking keywords space.
For example, relevant to this proposal, if/when we support “tail return foo()" for example, you don’t want to take “tail” as a keyword to make “tail foo()” work.
> Not even Slava Pestov would factor Swift that aggressively.
Underestimating Slava is not a good idea! :-)
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151206/8e87f6ef/attachment.html>
More information about the swift-evolution
mailing list