|
|
|
|
|
by ratww
2093 days ago
|
|
Optionals doesn't exist because of ObjC compatibility. They are a hallmark feature in functional languages like Haskell and Scala, and in other modern languages like Rust and Kotlin. Even C++17 introduced std::optional. And I completely disagree, they are one of the best features of any language and are able to remove a whole class of very annoying bugs. And sorry, but I didn't understand the part about the initializer pattern... are you talking about constructor overloading? This has also been a traditional feature of OOP languages for decades. |
|
The problem is that every Objective-C type is essentially an optional, so any Swift code using Cocoa frameworks, based on Objective-C, is a deluge of optionals. Your entire code base is constantly dealing with them. It's a mess.
> I didn't understand the part about the initializer pattern... are you talking about constructor overloading?
I'm talking about this: https://docs.swift.org/swift-book/LanguageGuide/Initializati...