News for hackers. Stuff that matters.
Re:Apple’s Use of Swift in iOS 13 by AJRF on Thursday September 26, 2019 @06:43PM (#21086385)
Why not use `if let` instead? Way safer
Re:Apple’s Use of Swift in iOS 13 by saagarjha on Thursday September 26, 2019 @06:46PM (#21086413)
The issue I'm talking about is what to do when you don't have a good idea of what to put in the "else" branch.
Re:Apple’s Use of Swift in iOS 13 by mruts on Thursday September 26, 2019 @06:52PM (#21086465)
A usrful error message?
Re:Apple’s Use of Swift in iOS 13 by saagarjha on Friday September 27, 2019 @02:20AM (#21088997)
This isn't always possible.
Re:Apple’s Use of Swift in iOS 13 by mruts on Friday September 27, 2019 @06:43AM (#21090415)
Why not? I always fold or map my option types. Sometimes I return None and caller handles it, sometimes I print a useful and informative error message. One should never ever directly unwrap an option value. In fact, some languages and libraries simply don’t allow it.