Squeak programming question

Patrick Logan patrickl at gemstone.com
Mon Mar 22 20:59:00 UTC 1999


Sorry. I did not intend to reply to this message. I misapplied an
Emacs macro!

>>>>> "Dan" == Dan Ingalls <DanI at wdi.disney.com>

    Dan> I pretty much subscribe to the solutions proffered so far
    Dan> (returning an array and using a block).  However I offer the
    Dan> following for your entertainment (fasten seat belts)...

    Dan> Given a method like:

    Dan> twoValues ^ {1. 2}

    Dan> then the following code fragment

    Dan> 	{a. b} := self twoValues.

    Dan> will result in a=1, b=2.

    Dan> In fact you can even do

    Dan> 	{a. b} := {b. a}

    Dan> to exchange two values without a third temporary variable.

    Dan> 	- Dan

-- 
Patrick Logan                 mailto:patrickl at gemstone.com
Voice 503-533-3365            Fax   503-629-8556
Gemstone Systems, Inc         http://www.gemstone.com





More information about the Squeak-dev mailing list