Multiple Returns, was Re: Common Lisp style macros inSmalltal k?

Stewart MacLean stewart.maclean at nzhis.govt.nz
Wed Jan 19 23:11:22 UTC 2000


> Just to keep this topic from dying, it would be fun (maybe it 
> has been done already) to create a class of named tuples, 
> where you could say,
> 
> 	^ Tuple voltage: 220 current: 7.5 startingTorque: 185
> ....

So may ways of skinning that cat ...

In the past, rather than creating a new class I've used a class called
OpenObject which has an IdentityDictionary to store key/value pairs, where
the key is the instance variable name.

I use the doesNotUnderstand trick to dynamically create getter/setters which
lookup or add to the dictionary based on the message selector.

Doesn't carry the overhead of extra classes but access time would be higher.
Very useful for design and build (or is that build and design? :)).

One could use an instance of this class to return as many values as you want
with clarity.

Cheers,

Stewart





More information about the Squeak-dev mailing list