News for hackers. Stuff that matters.
Re:Swift 1.2 and Xcode 6.3 beta by WildUtah on Monday February 09, 2015 @05:34PM (#9024233)
if-let is great. I don't know where it started (apparently upthread they say Rust and swift have been swapping the idea) but Clojure has had it since 2008.[0]

    (if-let [name name-whose-value-is-possibly-null]
      (something-to-do name))
[0] https://clojuredocs.org/clojure.core/if-let
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);
Re:Swift 1.2 and Xcode 6.3 beta by melling on Monday February 09, 2015 @05:52PM (#9024367)
I imagine everything in Swift has been borrowed from another language. OCaml, Go, etc. I'd be more interested in other great language features that are missing from Swift that are in other "classic" languages like OCaml, for instance.