Newbie question

Klaus D. Witzel klaus.witzel at cobss.com
Mon Jul 30 18:47:52 UTC 2007


On Mon, 30 Jul 2007 19:58:34 +0200, Jason Johnson wrote:
> On 7/30/07, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
>> On Mon, 30 Jul 2007 18:04:04 +0200, J J (in a hard-to-read HTML message  
>> :) wrote:
>>
>> > That would probably require a big change to
>> > implement and you end up with something Smalltalk can already do other
>> > ways, and become (more) incompatible with other dialects.
>>
>> You can always do ^ {this. and / or. that} for returning multiple  
>> values,
>> without any change in Squeak.
>
>
>
> Yes, that's why I said "something Smalltalk can already do".  But  what
> Smalltalk couldn't do here (without modifications) is catch that return  
> in
> two (or more) separate  values in one line as:
>
> |a b|
> {a.b} := someFunctionReturningTwoValues


If the vars are allocated consecutively (in address space) then you must  
now wait for language extension to happen: ugly, but it works

| a b |
  a := b := 1.
  (1 to: 2) with: {a + 3. b + 4}
   do: [:ix :val | thisContext tempAt: ix put: val].
  ^ {a. b}

Same for iVars, example #forceNewFrom: :| and other clients of  
#instVarAt:put: ...




More information about the Squeak-dev mailing list