3 ms·
I tend to disagree with this premise. Swift, like any language, has some questionable features, but in general I find it extremely consistent and easy to work
by skohan 6y ago
I tend to disagree with this premise. Swift, like any language, has some questionable features, but in general I find it extremely consistent and easy to work with. I think mostly what people point to as "extra complexity" comes down to right-sized tools for handling nulls in a correct way, and syntactic sugar which makes it possible for write interfaces which make it possible to write code very close to the level of intent.
When I read complaints like this I wonder if the author has spent almost no effort trying to learn the language and just wants to be able to sit down and write Go or C#.
- dmitriid 6y agoI spent no effort learning C#. I just sat down and started writing it. Even though C# is a larger language than Swift and is getting larger. I tried to write a small project in Swift and I really have no intention on ever going back to Swift. It's not a designed language. It literally is a kitchen sink of quite poorly thought out features and "we couldn't be bothered to design a solution, let's just throw in this patch".
- skohan 6y agoWhat specifically gives you that impression? I'm only asking because I find that Swift is more conceptually coherent than most other languages I have worked with. The impression I get of Swift is that it takes a bit more effort to get over the learning curve since it introduces some novel concepts (null handling, affine types, the protocol system) but mostly it makes a lot of sense and becomes very nice to work with after getting over the hump. C# seems easy to pick up by comparison because it's basically like a Java dialect and you just need to map the keywords etc.
- dmitriid 6y ago> What specifically gives you that impression? https://news.ycombinator.com/item?id=23520626 https://news.ycombinator.com/item?id=23520626 > since it introduces some novel concepts They are not terribly novel
- skohan 6y agoI mean novel relative to Java/C#. Of the features you mentioned: - guard is consistent with the priority Swift puts on explicit null handling. An optional is never transformed implicitly into a value. I actually think this is a very good thing and makes Swift easy to reason about in practice, even if it occasionally adds a bit of boilerplate. - variadic generics are a hole in the language, I agree with you completely there. - as far as the `some` keyword, existential types are also a concept in Rust and for good reason. With a powerful type system like these languages have, it's a distinction which has to be made in some cases. How would a better type system solve this problem? - How would the compiler replace `callAsFunction`? Also the inclusion of callable types is consistent with the design philosophy of Swift to allow the user to express interfaces in which ever way he sees fit. Honestly your criticisms read like you're trying to find fault with the language without making the minimum effort to understand why these features might have been designed the way they are.