Monday, February 23, 2009

More Objective-C

Another annoyance is the use of the * to indicate that the variable is reference or a pointer, instead of the actual variable location. This is a pet-peeve of mine in C and C++ as well. For objects, this is just ridiculous, since it is required to be a pointer. It should just be convention that all object variables are references and not require the extra, annoying syntax. It just gives you an error if you leave it out anyway.

All variable names are references as far as the programmer is concerned. Whether that is a direct memory location or a pointer to a memory location in the heap should be handled by the compiler and causes no conceptual problems for the programmer. Java does this. Smalltalk does it as well, handling immediate objects (primitives in Objective-C or Java) under the covers. There is no need to make a high-level language look like assembly language.

I believe this practice came about because people didn't know how to write proper parsers, but there is probably a better reason. It seems so cumbersome.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home