5 ms·
That’s the biggest reason I don’t like Swift- it’s terrible syntax. I hate let, var, func. I hate the backwards variable definitions. I hate the crazy punction
by apple4ever 9y ago
That’s the biggest reason I don’t like Swift- it’s terrible syntax.
I hate let, var, func. I hate the backwards variable definitions. I hate the crazy punctionation symbols (dots, question marks).
I agree with a lot of what Smith says about Objective-C. But my biggest personal reason is the above. I find Objective-C beautiful and Swift ugly.
- Koshkin 9y ago> Objective-C beautiful and Swift ugly That's subjective. Unusual - yes, but ugly? Why? I'd say, it is quite beautiful, in its incomprehensibility (to the untrained eye).
- abritinthebay 9y agoI find this fascinating because the main reason I never did iOS development at all (as a hobby) is that I found Obj-C just so goddamn ugly and awful (java level ugly) that I avoided it. Swift changed that completely. I finally find native iOS readable.
- wingerlang 9y agoIf you use it for more than a few hours you just wont think of it anymore.
- pivo 9y agoI write in both ObjC and Swift. It takes more than a few hours to get used to both languages but it’s also true that you get used to both. I prefer the relative terseness of Swift and also find the language more elegant and safer than ObjC.
- abritinthebay 9y agoTried that. Obj-C was just constant nails-on-a-chalkboard annoying. Too verbose, overly clunky syntax, etc. So I’m afraid that wasn’t the case.
- wingerlang 9y agoI guess hours was an understatement. The point is that I guess most people hate the style on first sight, I definitely hated it. But it's been a while and now I like it a lot, the verboseness makes the code and intentions clear (you just have to read a bit).
- abritinthebay 9y agoIf it was the only open on iOS then yes, I could live with it. It’s not - thank god - so I don’t have to. So I won’t.
- Apocryphon 9y agoObjective-C has verbosity that's very expressive and serves a purpose.
- abritinthebay 9y agoWhile true, I find I can do just as much in other languages that done have such an ugly verbose syntax. It’s ugly for a reason but that still means it’s ugly.
- Apocryphon 9y agoEh, I'd argue that its verbosity is less ugly than say Java. I can see why people might thing square brackets are ugly, though I prefer it to the double-colon and angle bracket fest that is C++, but what else do you find uniquely ugly about Objective-C? Infix operators are nifty and promote clarity.
- blueprint 9y agoits
- adamnemecek 9y agotry it for a bit. you'll never look back, pinky wear.
- Sharlin 9y agoDefinitely subjective. It's easy to argue that it's actually the C family of languages that have a backwards declaration syntax - in case of complex declarations, not just backwards but completely crazy inside-out zigzag [1]. Yes, there's a logic in it, but it's definitely not intuitive. On the other hand, the "type-on-the-right" syntax is quite popular outside the C family. Pascal, Ada, Go, Scala, Rust... [1] http://www.unixwiz.net/techtips/reading-cdecl.html http://www.unixwiz.net/techtips/reading-cdecl.html
- kenshi 9y agoNot sure why this is (was?) being downvoted. Yes it expresses a subjective opinion. Programmer preferences on languages, tooling and other things involve subjective opinion. We are all humans, not purely rational automatons. There is nothing wrong with a purely subjective, and taste driven argument. How much weight you choose to give it is another matter.
- AsyncAwait 9y agoVery subjective, I for one like practically everything you listed as not liking about the syntax: > I hate let, var, func For me it increases readability, for example when I see let, I can make assumptions about it not being mutated, which is a huge win in a large codebase. > I hate the backwards variable definitions. To me it says, "this is a variable called x of type String", which seems to make sense to me, definitely more so that the C way. I hate the crazy punctionation symbols (dots, question marks). Question marks denoting optionals seems very clear, like "is String? really there?" > I find Objective-C beautiful and Swift ugly. See, I am the other way, I don't really find [[]] all that beautiful.
- fauigerzigerk 9y ago>when I see let, I can make assumptions about it not being mutated, which is a huge win in a large codebase. What we know is that this won't work: let p = Person("one") p = Person("two") But we don't know whether this will work: p.name = "three" It depends on whether Person is a struct or a class, but that information is not available locally. let/var is fine, but in terms of information content it is strictly worse than what const can do in C.
- AsyncAwait 9y agoYou're right, if reference types are involved, it becomes tricky, however to the extent that Swift encourages value types, it still provides value. > in terms of information content it is strictly worse than what const can do in C. True, however the Swift community largely adopted a "use let first, only use var if absolutely necessary" approach, which is strictly better in terms of mutability-related bugs than what it was in ObjC/C, as mutability there is used much more liberally than in Swift.