Message Eating Null - article
azreal1977 at hotmail.com
Sat Jul 28 13:37:18 UTC 2007
> Date: Thu, 26 Jul 2007 13:14:52 -0700> From: tapplek at gmail.com> To: squeak-dev at lists.squeakfoundation.org> Subject: Re: Message Eating Null - article> > > What on earth are you talking about????? That is #inject:into:, known in> > functional programming as a fold. > > I agree; that is a seriously obfuscated way to access the last> number dialed. I don't know how often 4-level chaining would> arise in practice, but I would hope it would be as simple as:> > ^ self office phone lastNumberDialed asString> > Anything more complex is not lazy enough to get diligently> applied everywhere it shouldYes, but it isn't quite that simple. Normally I would do exactly what you suggested. But in that case I would want a debugger if any of those messages returned nil. If you want different handling for nil then the default you have to do a test after each message send. This can either be done by making a special object as Keith suggested, using a fold as I suggested or brute forcing your way through as in Keith's example of what not to do. :)
Don't get caught with egg on your face. Play Chicktionary!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev