4 ms·
i can't believe how much people here on HN love swift! do you guys really love stuff like implicitly unwrapped optionals and awkward syntax where you need excla
by iliketosleep 11y ago
i can't believe how much people here on HN love swift! do you guys really love stuff like implicitly unwrapped optionals and awkward syntax where you need exclamation marks all over the place. not to mention their insanely complicated use of enumerations. what about a completely half-baked standard libraries where even basic string operations such as doing a substring are unnecessarily complicated and verbose? i simply cannot see any real basis for all the love for swift.
- danappelxx 11y ago>implicitly unwrapped optionals This only exists for objective-c introp, and the creators are actively trying to find ways to get rid of it. On the other hand, in nearly every other language, all pointers would be considered implicitly unwrapped optionals, while in Swift you get optionals built in (food for thought). >awkward syntax where you need exclamation marks all Oh come on, syntax does not define a language. If they used a different character or an operator, would you be more happy? Either way, it does take some getting used to but eventually it feels natural. >insanely complicated use of enumerations What?! This is one of my favorite features! You can represent so many things with an enum and it can make your code much safer. My favorite two examples are representing JSON as an enum, and the fact that Swift's Optional is actually just an enum with cases .none and .some(T). >basic string operations such as doing a substring are unnecessarily complicated and verbose I somewhat agree with you on this. They have their reasons (mostly because strings can have varying sizes, so indexing a utf8 string, for example, can give unexpected results) but I still wish they did something about it.