3 ms·
> The first major point (which is found at the end of this post) in any "defense of Obj-C" should be that this is a very pragmatic language. "Pragmatic", much
by masklinn 15y ago
> The first major point (which is found at the end of this post) in any "defense of Obj-C" should be that this is a very pragmatic language.
"Pragmatic", much like "practical", is utterly worthless for programming language discussions. It means something different to everybody, and it's basically the tool you'll reach for when you have absolutely nothing good to say about the language you're trying to "defend".
Both "pragmatic" and "practical" should be the godwin points of PL discussion. They're complete bull.
> The point is to understand why we have brackets, because they allow for named arguments without colliding with existing C syntax.
Just because there are reasons it's done that way does not mean it's any less ugly, does it?
> Additionally, they make it clear to the user that what is about to happen is not a traditional method call, it is a message send.
For pretty much all OO PL languages, the distinction is just cutesy, the end result is that you're synchronously calling a method on an object, whether you call it "message" or "method" has little relevance.
> This is because you can do both in Obj-C
Do you mean that in a "function pointer in a struct" sense? This would use the `->` sigil would it not? And obj-c 2.0 managed to include dotted property names, so that could have been used (obviously, it wasn't because obj-c merges Smalltalk syntax into C and Smalltalk's message-send syntax does conflict with C if unbracketed)
> It's possible to take Obj-C without Cocoa, and write a framework that is just as non-verbose as Python
Not quite, Obj-C has structural deficiencies (in part inherited from C) which mean it has boilerplate you can't do without, such as the duplications between header and implementation files.
For much of its history, it also lacked any form of "blocks" (and those added in obj-c 2 are pretty verbose), meaning your Obj-C code would have a harder time with scoped resources than the equivalent Python code.
Other intrinsic verbosity issues of obj-c: iterations pre-Obj-C-2 (and fast iterators), type annotations, retain/release calls (we'll see how ARC fares), ...
I would say embracing Cocoa's chosen verbosity (although I sometimes find it misplaced) is a much better strategy than claiming Obj-C can be as terse as Python.