News for hackers. Stuff that matters.
Re:Swift 1.2 and Xcode 6.3 beta by loqi on Monday February 09, 2015 @08:07PM (#9024809)
C++98 (maybe earlier) has a similar feature:

    if (mytype* p = find_or_null(blah))
        foo(*p);
Still have to dereference p, but at least it's only in scope when doing so is safe. Also goes well with auto and std::optional:

    if (auto opt = find_or_none(blah))
        foo(*opt);

There are no comments on this comment yet.