[ENH] Lispy list functions

Lex Spoon lex at cc.gatech.edu
Fri Sep 10 13:35:45 UTC 1999


Ian Piumarta <Ian.Piumarta at inria.fr> wrote:
> (Excuse my idiot ramblings: I'm still not back in "serious" mode... 
;-)
> 
> > But if
> > I use it *intentionally* it should work. 
> > 
> > Now, how do I tell the system if I intended this or not?
> 
> 	Object>>asCollection
> 	    ^self asOrderedCollection
> 
> 	Collection>>asCollection
> 	    ^self
> 
> suivi de...
> 
> 	anyObject asCollection someCollectionProtolThingOrOther
> 

You could just do {anObject} ....

The problem with making an object act like a one-element collection is
that a collection is also an object.  Consider "x do: [ something ] "
where x happens to be a string, which is a collection.  You might want
to process the whole string instead of iterating over the characters.

Lex





More information about the Squeak-dev mailing list