It is by far the worst language I’ve used professionally.
While I don’t love Swift it is still a breath of fresh air compared to ObjC.
It is by far the worst language I’ve used professionally.
While I don’t love Swift it is still a breath of fresh air compared to ObjC.
Typically I wrap the ObjC code which needs to call into system framework in subsystems which then expose a simplified C API (same with C++ libraries, wrap the C++ shim under a simplified C API), so that most platform- and library-agnostic code is written in plain C.
ObjC never got in the way though, and the nice thing is that (unlike C++) it supports the latest C features.
C++ already supports more C than it should.
The '@' might look ugly but it's a good way to separate ObjC keywords from C and C++ keywords, so that ObjC can introduce new keywords without risking to break existing code.
(but this like complaing that Python uses tabs for scope blocks, or that C and C++ have too many {}, it's just a matter of getting used to it)
Forgetting how hard they are to type in some keyboards, depending on locale?
Not everyone is using US layouts.
{ } is just as bad on German keyboard layout ({} is right-Alt 7/0 and [] is right-Alt 8/9 - on Windows at least, don't even remember on the Mac).
That's basically why I switched to English keyboard layout right after I left the Amiga (which actually had a decent German layout for programmers).
> Dot syntax does nothing for regular messages.
True, but at least in the Cocoa and Metal code I usually write, there's a lot more property accesses than traditional method calls.
Objective-C's simplicity and minimalism is what makes it one of my favorites.
I'm enough of a purist to think Obj-C 2.0 (introduced around 2007 at the same time as iOS) was mostly a mistake. In old Objective-C, it was absolutely clear when you were sending a message. You couldn't mistake a line of C code for an Obj-C message call.
But Obj-C 2.0 lets you use the same syntax for message calls and struct member access, as in:
foo.view.bounds.size.width
Two of these dots are expensive virtual message calls. The other two are practically free stack pointer offsets. It's not in good C spirit to introduce this kind of confusion about performance impact. (However it's very much in the worst C++ spirit of frivolous overrides.)And the benefits were mostly meaningless because the old way (which still works) was barely any longer to type, especially with IDE autocomplete:
[[foo view] bounds].size.widthAnd what's even worse is that the semantics are muddled.
foo.view.bounds.size.width = 200;
This will not set the width of the view to 200.I'm in 100% agreement, you should never hide the message passing syntax, and am not a fan of this feature.
Alas it was probably introduced as a sop to those people that are constantly complaining about the syntax, and in the process made the language worse ergonomically, not better.
The one that is neither is objc (ignoring recent awesome improvements like objc_direct).