Message Eating Null - article

J J azreal1977 at hotmail.com
Sat Jul 28 14:26:08 UTC 2007


> Date: Sat, 28 Jul 2007 09:43:15 +0200> From: cdegroot at gmail.com> To: squeak-dev at lists.squeakfoundation.org> Subject: Re: Message Eating Null - article> > I think it *is* an honest argument. One of the strong points of> Smalltalk is its readability, and that code block was awful in that> respect.The block itself, or you mean the #inject:into:?  If you just mean the block, then I must say that's quite a reaction!  I would certainly have switched to #ifNotNil: or something before committing it to a repository but it wasn't *that* bad.If you mean the #inject:into: then I disagree.  To me the truly interesting thing about Smalltalk is it's beautiful mix of OO and functional programming.  I don't go around throwing #inject:into: into everything I see, but in this case the example was an obvious traversal that would either require creating a new class (as he did) or using a general operator to short-circuit a call chain if a nil shows up (since nil was an acceptable value).  In my personal opinion the #inject:into: would be more readable unless you specifically point out that a NullObject pattern is being used.  But certainly wouldn't want some preference somewhere that says "switch my image to null pattern".Writing unreadable code does not mean using advanced features of the language/libraries to simplify something.  I would certainly choose the #inject:into over that mess with temp variables all over.  We shouldn't fear to use the power of our language.
_________________________________________________________________
Local listings, incredible imagery, and driving directions - all in one place! Find it!
http://maps.live.com/?wip=69&FORM=MGAC01
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070728/178b4aac/attachment.htm


More information about the Squeak-dev mailing list