News for hackers. Stuff that matters.
Re:Stop the Hate: Obj-C Deserves Your Love by redstripe on Tuesday July 13, 2010 @12:10PM (#1511774)
I don't understood why people think automatic deallocation = garbage collection = slow language. You can have reference counting without garbage collection. It's pretty obvious to a compiler when a variable has gone out of scope and can be dereferenced (and deallocated immediately at 0).

Using a language like obj-c where you have to do memory management manually just seems so archaic after using modern languages. Plus there is strange property duplication syntax, split header/code files, a GUI editor that doesn't easily wire events to code, named parameters, c/smalltalk calls mixed together, etc.. it's just a mess.

In my brief stint using it the whole time I kept thinking this would be so much simpler if I could do it the XYZ language way. Obj-C is a language that you have to try really hard to like. If you have to convince yourself then maybe it's not that good.

Re:Stop the Hate: Obj-C Deserves Your Love by Zev on Tuesday July 13, 2010 @12:21PM (#1511819)
I don't understood why people think automatic deallocation = garbage collection = slow language. You can have reference counting without garbage collection. It's pretty obvious to a compiler when a variable has gone out of scope and can be dereferenced (and deallocated immediately at 0).

  `[object performSelector:sel];` // where `sel` may be - retain
How should the compiler optimize that?

Plus there is strange property duplication syntax

You don't have to bother with that anymore. The only reason you ever did with iPhone dev is because the iPhone Simulator didn't support the modern runtime. If you only tested on the device, you never had to bother with it.

As of LLVM 1.5 (in Xcode 3.2.3) or 2.0 (in 4.0) on 10.6, the compiler can fake enough for runtime support (and only requires @property declarations - no more ivar or @synthesizers): http://www.mcubedsw.com/blog/index.php/site/comments/new_obj...

named parameters

Objective-C doesn't have named parameters. It intertwines the method names with the arguments that it takes.

Instead of `void doStuff(foo, bar, baz);`, its `- (void) doStuffFoo:(id) foo bar:(id) bar baz:(id) baz;` (which can also be written (and compiled) as: `- (void) :foo:bar:baz;` if you wanted).

Re:Stop the Hate: Obj-C Deserves Your Love by gte910h on Tuesday July 13, 2010 @12:20PM (#1511815)
>Using a language like obj-c where you have to do memory management manually just seems so archaic after using modern languages.

That's not an Objective C thing, the language has garbage collection, just it isn't enabled for the mobile platform, for the reason it eats power and memory.

Re:Stop the Hate: Obj-C Deserves Your Love by redstripe on Tuesday July 13, 2010 @12:33PM (#1511868)
My point was that it is possible to have deterministic deallocation without garbage collection. This can be done at compile time. So I don't buy the "eats power" excuse for needing manual memory management.
Re:Stop the Hate: Obj-C Deserves Your Love by gte910h on Tuesday July 13, 2010 @02:21PM (#1512263)
No it's not. For some programs, it is possible to tell, for others, it most certainly is not.
Re:Stop the Hate: Obj-C Deserves Your Love by protomyth on Tuesday July 13, 2010 @12:18PM (#1511806)
First, even the "manual" version of garbage collection (the retain/release) pattern is pretty trivial with Objective-C (more so with the new property syntax). Once you know the rules it was pretty automatic and really didn't cause that many problems. It was more a problem with the "checklist" language comparisons.

The "property duplication syntax" (I assume you mean the declare versus synthesis) is there for flexibility and so you can do some pretty good customization to make your classes work better.

For OS X, Objective-C now has garbage collection that works pretty well.

Re:Stop the Hate: Obj-C Deserves Your Love by vegashacker on Tuesday July 13, 2010 @12:39PM (#1511902)
Objective-C's retain/releasing is only trivial if you're doing fairly simple stuff. Ever create a circular reference with objects? Ugh...
Re:Stop the Hate: Obj-C Deserves Your Love by famfam on Tuesday July 13, 2010 @06:05PM (#1512933)
reference counting != "manual garbage collection"