4 ms·
He did say he was going to write a series of articles about Swift. Give him time. :-) The main "aha" point of this article for me was the way optional values
by rsfinn 12y ago
He did say he was going to write a series of articles about Swift. Give him time. :-)
The main "aha" point of this article for me was the way optional values eliminate a whole class of programming errors that are pervasive in the "C family" of languages, and does so in a rather elegant way. (Apparently Scala has a similar capability, but I'm not familiar with Scala.)
- bronxbomber92 12y agoScala, Ocaml, SML, Haskell, Swift, C# (the Nullable type) and many other languages have Optionals/Maybes/Nullable types (all names for the same thing). I agree Optional's should booster safety (in the iOS/OS X world) if Swift can convince everyone to start using them.
- derefr 12y agoPeople are probably most familiar with them, I think, in the form of Haskell's Maybe monad. (Though that has the extra feature of black-holing computations that try to operate on Nothing.)
- Dewie 12y ago> People are probably most familiar with them, I think, in the form of Haskell's Maybe monad. Or just simply "Maybe" ;) https://groups.google.com/forum/#!topic/elm-discuss/1acyOfxvasA https://groups.google.com/forum/#!topic/elm-discuss/1acyOfxv...
- bronxbomber92 12y agoSwift has the "black-holing" as well in the form of either explicitly calling Optional's map method, or the syntactic sugar: myTypeTOpt?.methodOnTypeT()