[swift-evolution] Fwd: Propagating Optionals

Trans transfire at gmail.com
Fri Oct 7 16:56:20 CDT 2016


Just discovered that none of my replies made it to the mailing list.
Doesn't it bug others that the default reply is to the author and not
the list?


---------- Forwarded message ----------
From: Trans <transfire at gmail.com>
Date: Sun, Sep 25, 2016 at 9:36 PM
Subject: Re: [swift-evolution] Propagating Optionals
To: William Sumner <prestonsumner at me.com>


On Sun, Sep 25, 2016 at 7:26 PM, William Sumner <prestonsumner at me.com> wrote:
>
> You can accomplish this using parenthesis:
>
> let roomCount = (john.residence ?? homelessShelter).numberOfRooms

Yea. Don't know why that escaped me. Though it does start to look long
in the tooth if there is more than one.

    let x = ((foo.bar ?? dbar).baz ?? dbaz).zee

vs

    let x = foo.bar:dbar.baz:dbaz.zee

But then again maybe that is too concise.


-- 
People with courage and character always seem sinister to the rest.
--Hermann Hesse

Trans <transfire at gmail.com>
7r4n5.com      http://7r4n5.com


More information about the swift-evolution mailing list