On Jul 18, 2009, at 7:54 AM, Andrew Thompson wrote:
Or you go the other way, obey Java semantics and just return null as
soon as we see a nil. That'll obviously NullPointerException as soon
as it is used.
Returning an NSObject with nil inside is almost the same thing,
because you can't use it without getting an exception, but to a Java
programmer if getFoo() returns null, Foo x = getFoo() should result
in x being null, not x being an object that NullPointers when it is
Or as I said, go the other way and actually make it work like
Objective C ... return an object "NSNil" that returns 'this'
whenever any method with an object return type is called.
The later allows people to "port" code from Cocoa more naturally,
the former is the least surprising to Java programmers.
The current halfway house seems less than ideal.
What did you decide for this in the end Duncan? As I said, I think
either end of the spectrum could make sense, with a slight preference
for just returning null.
The middle ground is the hardest to be comfortable with for me.
AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside
(see you later space cowboy, you can't take the sky from me)