Re: [OT] "Fluent Interface"? Welcome to NeXT
Re: [OT] "Fluent Interface"? Welcome to NeXT
- Subject: Re: [OT] "Fluent Interface"? Welcome to NeXT
- From: Lee Ann Rucker <email@hidden>
- Date: Fri, 3 Aug 2007 11:23:19 -0700
On 2.8.2007, at 20:39, Jeff Laing wrote:
This was a very common idiom in earlier Obj-C. Well before "void"
existed, every C function (and therefore Obj-C method) had to
return a
value. It was common to return self on success, and nil on failure.
That way, method calls could be chained as above.
Yes, I understand that, much like I understand that other common
idiom in
the 70's led to the Y2K nightmares that kept Cobol programmers in
Porsches.
I still wonder, how on earth do you determine "what went wrong"
when you
have a chain of operations like this that just silently stops when
something
fails?
In fact the whole "sending a message to nil silently succeeds" has
to be the
most stupid decision ever in language design. Its benefits are
massively
outweighed by its ability to mask problems, in my opinion.
Ah, now that's where Smalltalk was different - nil was a full-fledged
singleton object in its own right, and send to nil would fail with
"methodNotUnderstood" - unless you'd implemented it, of course.
I'd far rather have a good old access violation than have a program
merrily
wander onwards not realising that its dealing with a nil pointer.
No wonder
they needed to add cruft like NSZombie to debug problems...
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden