3 ms·
I can share my love of Swift - Optional has made null pointer exceptions virtually non-existent. There are occasions where deserialization does result in a nil
by ppeetteerr 7y ago
I can share my love of Swift
- Optional has made null pointer exceptions virtually non-existent. There are occasions where deserialization does result in a nil value where one is not expected, but that's rare. I think this is as massive as garbage collection was back in the day.
- The language is in a sweet spot between something convoluted and heavy like Java and something overly simplistic like PHP/Ruby/Python. It's perfect for software development and large code-bases with a low learning curve.
- There is no magic (methods, properties, etc). Everything is explicit but not wordy. This may change in the future but I hope it never does.
- It's more legible than Kotlin with fewer unnecessary language features. Speaking of which...
- It's a simple language and its syntax is straight forward
It's not a perfect language:
- The package manager needs a lot of work
- Extensions can lead to confusion (eg. in the case of conformance to protocols (interfaces)).
- I would like an optional garbage collection system for long-running processes (e.g. server-side applications)
- I would like it to perform even better
You can nitpick syntax anomalies with any language, but a language is defined by how easy it is to scale to multiple programmers, how applicable it is to a problem, how well it performs, how easy it is to read for someone new to the system, how it helps the programmer not commit mistakes, etc. Of all the languages I've written, none has been as successful in all regards as Swift.
- ken 7y ago> It's a simple language and its syntax is straight forward Wha? It has about 100 reserved words — more than C++, now, I think. Even its own designer said [1]: “You’re unlikely to run into anybody that says that Swift is a simple language. Swift is a complicated language.” If you consider Swift simple, what language do you consider complex? Of all the languages I've written, none has been as complex as Swift. [1]: http://atp.fm/205-chris-lattner-interview-transcript http://atp.fm/205-chris-lattner-interview-transcript
- ppeetteerr 7y agoYes, it's simple from a user's perspective. Even the quote in your comment is then followed by Chris talking about how easy it is to learn Swift (e.g. `print("Hello world!")` is a valid program). There are a lot of keywords in Swift, but that is not what makes a language complicated. They are all in English, after all. Symbols and unique concepts are what complicate a language because they are not explicit or unorthodox. For instance, using `:=` or `(setq x (1+ 2))` for assignment instead of `=`.