3
OmerFlame
20d

Me and @asafniv cannot settle this argument and we need your conclusion.

What syntax makes more sense, Objective-C or Swift?

In my opinion, Swift's syntax is better than Objective-C, but Asaf's opinion the the opposite.

We failed to settle this argument and that is why we need YOU to give us your opinion.

In the comments I will send 2 identical functions, one is written in Objective-C, and one is written in Swift.

Comments
  • 0
    This is Objective-C @asafniv
  • 0
    This is Swift @OmerFlame
  • 7
    @OmerFlame @asafniv having looked at both (and not knowing either lang), I've come to the conclusion that which syntax makes more sense to you is highly subjective of your programming background. If you come from C-like lang bg, are used to e.g. C#, Objective-C's syntax will make much more sense to you. On the other hand, if your bg is in pythonesque langs, or e.g. F#, Swift's syntax will make more sense to you. For me, they make equally much or little sense, but I'd prefer reading Swift - and as long as it's up to me, I'll touch neither.
  • 3
    Both are meh.
  • 1
    Swift
  • 4
    Coming from high level languages, swift is nicer to follow, but if you come from low level languages, objective-c would be better for you.

    Personally, I've always preferred swift over objective-c, it's one of the few languages that confuses the F out of me 😞

    Ps: I'm not an Apple dev.
  • 2
    Square bracket notation in Obj-C is a damn joke. That's everything wrong with it.

    It looks like they've tried to make C++ but much uglier than C++ (which is also pretty ugly with all the latest bells and whistles)
  • 4
    @iiii you mean cleaner with the latest bells and whistles. A lot of work in modern C++ is making things more unobtrusive and behind the scenes (case in point, template inference and getting rid of some of the more arcane template hacks with newer features, or compile time statements removing a good chunk of TMP)

    (I picked templates specifically because they're one of the ugliest parts of C++, syntactically)

    @OmerFlame looks entirely like a subjective difference to me, it's not all that different as say something like F# or Erlang or Haskell or heck even Rust would be.
  • 1
    @RememberMe nah. C++ gets more and more bloated with pretty obscure syntax because of all legacy compatibility. I wish someone finally went "Fuck this, the time has come to rewrite everything from zero" and make a C++ 2.0 with all the newest C++20 features but with much cleaner syntax. Otherwise C++ will become Perl level of arcane syntax.
  • 5
    @iiii ? Such as? With each revision of C++ my code gets cleaner, not dirtier. Ranges for example are amazing, so are concepts. Massive upgrade in cleanliness, both syntactically and semantically. The only dirty bits I encounter these days are either libraries with heavy templating (expression templates brrr) or some more arcane stuff like perfect forwarding and universal refs.

    To be clear - I appreciate *new* syntax as long as it takes something that was horribly ugly and simplifies it (eg. Concepts).

    Legacy code can still be an absolute drag, I agree, and C++ features can be hard to keep track of, also agreed.

    Rust and D are probably the closest to the kind of C++ 2.0 you're talking about.
  • 2
    @RememberMe concepts are godlike. Bringing Python interface typing to C++.
  • 3
    @RememberMe all for Rust, Rust for all!
  • 0
    @iiii I would liken it more to typeclasses in Haskell, but yes, that works too (pretty sure Python is inspired from there as well).
  • 0
    @RememberMe and Rust seems... too bloated with a lot of seemingly arbitrary restrictions. D looked nice when it was the last time I've looked over it, but it's still too niche to be used almost anywhere.
  • 0
    @RememberMe unfortunately I know nothing about Haskell, so cannot understand the reference.
  • 2
    @iiii Rust has a lot of unique features, some very very nice features, and some eh ones. Overall it's a really clean design for its design goals, I think. It really isn't easy to make a language with lifetimes, decently powerful abstraction, functional types, and a ton of static verification all in one package. (Most of the arbitrary restrictions you mention are to do with said static verification goal).
  • 1
    @iiii @RememberMe this made me think of the following:
    1986 - Brad Cox and Tom Love create Objective-C, announcing "this language has all the memory safety of C combined with all the blazing speed of Smalltalk." Modern historians suspect the two were dyslexic.

    ObjC and the square bracket notation is supposed to be derived from Smalltalk message passing. The end result? a botched implementation of what Smalltalk was, the syntax is beautifully simple there, in obj c? not so much. But I still prefer it over Swift.
Add Comment