News for hackers. Stuff that matters.
Re:Null Object Pattern in Swift by andrew_mason1 on Wednesday November 11, 2015 @11:40PM (#10551338)
I fail to see how optional chaining, Maybe monads (or Optionals, depending on your persuasion), or the Null Object pattern are fundamentally any different from each other.
Re:Null Object Pattern in Swift by sanderjd on Thursday November 12, 2015 @04:29PM (#10556277)
In languages with good type-checking and optional / maybe types (like Swift, Scala, Rust, Haskell, …), the null object pattern seems less useful, because the compiler makes sure you unwrap things in the right places. But the null object pattern seems really useful in languages like Ruby and Python, where attempting to use optionals tends to just replace null object errors with errors from forgetting to unwrap the value.
Re:Null Object Pattern in Swift by Camillo on Thursday November 12, 2015 @02:49AM (#10551838)
Well, the Null Object Pattern is clearly the worst of the bunch, since it requires a whole lot of extra code to set up. It also introduces maintenance issues since you need to keep adding methods to it. Basically, it's a horrid idea to use in Swift.