Obviously, it's not Swift's fault for that, but even if people at Apple make rookie mistakes such as using force unwrap operator, it tells something about the language.
Obviously, it's not Swift's fault for that, but even if people at Apple make rookie mistakes such as using force unwrap operator, it tells something about the language.
It's still often suggested by Xcode if you use an optional which has not been unwrapped in any way. "Click here to make error go away" adds an !.
--
[0] Unless you could invert the order of the unarchiving...not sure what difficulties that would cause.
Actually I was wondering with Swift had a lot of these things I don't see much in other languages. Optionals for example. Is it because it us focused on coding highly responsive UIs where different states might not yet be available?
But most new languages has some variant of this stuff: kotlin, scala, rust.
I program a lot in Julia which is a script language and it does not have allow you to use null freely either. May seem odd for a language that does not type check at compile time. But it actually makes sense.
C-family languages let you take off your whole leg with the slightest mistake.
In defence of Swift, it could still be that they spent less time bug-hunting than when they were developing in Objective-C, to reach the same, or inferior, level of program correctness.
Also, we're comparing a new product to a mature one. Were the original Objective-C programs stable in their first release?
Apple could have continued using the existing software, rather than just throw away stable code for the sake of new devs to use a new language.
Mandatory link to Spolsky's blog post on exactly this:
https://www.joelonsoftware.com/2000/04/06/things-you-should-...