Message Eating Null - article

Matthew Fulmer tapplek at gmail.com
Thu Jul 26 20:14:52 UTC 2007


On Thu, Jul 26, 2007 at 07:23:42PM +0000, J J wrote:
> > > widget setStringValue: #(office phone lastNumberDialed asString)
> > > inject: person into: [:obj :sel| o == nil ifTrue: [ nil ] ifFalse: [
> > > obj sel ] ]
> >
> > To me the above looks as close to perl as smalltalk is hopefully ever
> > likely to get!
>
> 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 should

-- 
Matthew Fulmer -- http://mtfulmer.wordpress.com/
Help improve Squeak Documentation: http://wiki.squeak.org/squeak/808



More information about the Squeak-dev mailing list