On Tue, Dec 12, 2017 at 12:42 AM, Slava Pestov via swift-evolution <
swift-evolution@swift.org> wrote:

> I think it gets confusing when you have multiple levels of nested
> expressions, eg
> foo(bar(x?)) + y?
> Slava

I'm not sure we need to optimize much for complicated nested examples, as I
don't think this is something that will happen a lot in practice. I imagine
the most common scenario will be a single call with one or more arguments.

Having said that, we did receive 2 different reasonable answers on what the
evaluation order would be for:
f(a(), b?)

(1) It desugars to:

if let someB = b {
f(a(), someB)

So a() doesn't get called if b is nil.

(2) "If you were to write this logic out by hand then you would
short-circuit it and this is analogous to current chaining behaviour so to
me evaluating left to right (as Swift usually does) and stopping at the
first failed unwrap would make sense"

So a() gets called if b is nil.
swift-evolution mailing list

Reply via email to