Squeak programming question

Tim Olson tim at jumpnet.com
Mon Mar 22 14:49:25 UTC 1999


>The only thing that occurs to me is
>something like:
> 
>^((OrderedCollection new) add: myDictionary add: mySet)
>
>and then disassemble the thing on the receiving side.  I'm
>not really crazy about this though.

Squeak has a shorthand notation for dynamically creating and assigning 
arrays of multiple values, using curly braces:

--------------
methodWhichReturnsTwoValues

     | mySet myDictionary |
          .
          .

     ^ {mySet. myDictionary}



methodWhichInvokesTheAbove

     | aSet aDictionary |
          .
          .

     {aSet. aDictionary} := methodWhichReturnsTwoValues

-----------

Note that this is Squeak-specific; it isn't standard Smalltalk notation.  
In cases like yours it is sometimes handy to use, but the more portable 
solution is to use "Array with: with:", or Continuation Passing Style, as 
mentioned in a previous message.



     -- tim





More information about the Squeak-dev mailing list