5 ms·
I used Swift in versions 1-4, so idk if it's better now, but the syntax seemed fancy and complicated for no reason. So many different ways to do simple things l
by morshu9001 9mo ago
I used Swift in versions 1-4, so idk if it's better now, but the syntax seemed fancy and complicated for no reason. So many different ways to do simple things like loops. Infuriating strings lib. Kinda believe the entire language was designed around emojis. And Xcode was a liability.
Rust is more complicated than C but has good reasons for everything it does. It's lower level too, which is fine. If I want high level, I look to JS and not Swift.
- saagarjha 9mo ago> Infuriating strings lib. Kinda believe the entire language was designed around emojis. Unicode but yes
- morshu9001 9mo agoI mean emojis specifically. Python or JS strings are designed for unicode chars. Swift made it about grapheme clusters, which are possibly a valid edge case for like Arabic emphasis marks but not something they'd be motivated to center the entire strings behavior around if it weren't for emojis. Weird part is the Swift way was still annoying even in cases where I wanted to manipulate strings with emojis very often. Had to build some custom pre-indexed string (just an array of 1-cluster Swift strings), cause find/replace/split/etc was too cumbersome and inefficient otherwise.
- saagarjha 9mo agoI think Swift made the right choice, though: it’s rare that you’d want to slice a grapheme. Usually you don’t have to build an index if you take a step back and design the algorithm around the indexing model.
- morshu9001 9mo agoThat's the thing, there is no indexing model. Every string operation is an O(N) seek. But even if you don't care about performance, it's just cumbersome. Looking at the SO questions for simple things like finding the position of a substring, it also lacked a lot of typical built ins until Swift 5. But that was like 5 years after GA.
- saagarjha 9mo agoThere's definitely an indexing model, it's just that it's similar to that of a linked list. You can do all sorts of useful operations on a linked list. Not everything is O(n) in this world.
- morshu9001 9mo agoYou can't do any linked list operations on this other than "get next" which is still kinda different
- saagarjha 9mo agoMaybe it would be helpful if you have an example that you’re having trouble with.