Objective-C (11)

1 Name: !WAHa.06x36 2005-06-17 20:32 ID:Tgndx3bI

So I've been trying to learn a bit of Objective-C, and one question springs to mind:

What the hell is this shit?

I keep hearing people say the syntax is simple and elegant. It may be simple, but this shit sure isn't elegant. It looks like two completely different programming langauges mixed together, which is pretty much what it is. For a couple of minutes I thought the named arguments for messages were cool, but then I realize that the FIRST argument is not named anyway, and people are trying to force this into making sense by naming their functions after the arguments they take. It's just a mess.

The memory handling is utterly absurd - it sort of pretends to be garbage-collected, but has very few of the benefits of a real garbage collected system. The fact that the Apple documentation has several pages of text that tries to explain when you should and when you should not release objects is quite telling. Object creation is no better. Init? Alloc? Copy? Memory zones? Who can keep track of all this? And really, memory zones? What the hell?

2 Name: #!usr/bin/anon 2005-06-18 14:57 ID:leice66l

ObjC is ghey. Don't you have anything better to do?

3 Name: !WAHa.06x36 2005-06-18 18:34 ID:68739sGM

You're kind of stuck with it when writing code for Mac OS X.

Thank god for Objective-C++. Mixing in even more syntax isn't exactly elegant either, but at least I don't have to keep saying [[Class alloc] init].

4 Name: madleser!r4YvKJpWUc 2005-06-24 13:14 ID:8GGpmJir

[Class new] =O. Macros might also help.
Ahem. Yes, objc is a bit verbose. well, the memory management I still find more convenient than the standard methods of C and C++, though the latter allows you to do the same.
I'd vote for a sort-of "nextgen" ObjC. Features like blocks, default arguments for functions, garbage collection and... a cleaner syntax. Kind of a compiled ruby. Yeah.

I decided to tinker with ObjC some more at some unspecified point in the future just to use Projectcenter to create GUIs.

5 Name: !WAHa.06x36 2005-09-20 22:05 ID:Vq7ItYhn

Update! Update! Update!

After using it for a couple of months, I've gotten more used to some of the weird idiosyncracies, and I can almost balance my retains and releases now! Almost. I even sort of enjoy some of the more reckless and crazy parts of the language. On a good day, it almost reminds me of Perl.

However, I also found more utterly retarded idiocy. For instance, what is up with NSArray and friends, and nil? Adding nil to an array or dictionary appears to be completely arbitarily forbidden. Having empty elements in an array is an obvious and useful feature, and forbidding it is pretty dumb.

Especially since the language adds the NSNullobject to give you a null object to add to arrays. This last parts leaves me speechless. First you forbid an arbitary action, and then you work around it. What is this, religion?

6 Name: #!usr/bin/anon 2005-09-21 00:34 ID:Heaven

>>5
Nurupo

7 Name: #!usr/bin/anon 2005-09-21 03:23 ID:Heaven

>>6

GA!

8 Name: !WAHa.06x36 2005-09-21 11:47 ID:EB7GUTxN

Today's programming trivia: Objective-C allows you to send messages (that's "call methods" to the rest of the world) to nil, meaning there are no NullPointerExceptions.

GA!

9 Name: #!usr/bin/anon 2005-09-21 12:59 ID:O/IAl8w3

two words: http://camelbones.sourceforge.net

obj-c/perl bridge framework for cocoa.

10 Name: #!usr/bin/anon 2005-09-21 14:25 ID:Heaven

I am having some trouble figuring out how you counted those words, there.

Also, people who say "two words:" are hopeless Slashdotters. Snap out of it!

11 Name: #!usr/bin/anon 2005-09-22 11:57 ID:Heaven

simple. a url is not a word, so the sentence "two words: http://..../" contains two words. but you're right, I do read /. from time to time (although i've never seen anyone there use "two words:"); you win. i'll put snapping out of it at the top of my todo.

This thread has been closed. You cannot post in this thread any longer.