3.9 vs. 3.10 : Closures, fixTemps
Klaus D. Witzel
klaus.witzel at cobss.com
Wed Dec 19 15:43:21 UTC 2007
On Wed, 19 Dec 2007 15:50:23 +0100, Mathieu Suen wrote:
> Hi,
>
> Have you try:
I would have attempted the same as Math did below since the first (now
omitted) #fixTemps made a private copy of temp var newModel (just for use
by the block given to #commit:).
> renderNewModelButton: html
> { M1. M2 } do:
> [ : modelClass |
> html submitButton
> callback:
> [ | newModel |
> self session magma commit: [
> newModel := self repository models add: modelClass new.]
>
> self call: (newModel viewerClass new model: newModel).
> selectedModel := nil ] fixTemps; value: #New , ' ' ,
> modelClass name ]
>
> On Dec 19, 2007, at 3:08 PM, itsme213 wrote:
>
>> "Mathieu Suen" <mathk.sue at gmail.com> wrote
>>
>>> The NewCompiler status is:
>>>
>>> Compiler:
>>> - Block closure - Work
>>
>>
>> I have not yet tried NewCompiler, but here is one that does not work in
>> 3.10. At point 1>>, newModel is correct and non-nil. At point 2>>
>> newModel
>
> Of cours at pont 2 is nil cause:
> The #fixTemps of the commit block will create a copy of the newModel
> temp.
> Then when you affect a value to the newModel inside the block you are
> affecting the copy not the original one.
>
> Will the second fix temp will prevent you having modelClass being the
> same for the commit of M1 and M2.
> It will copy the modelClass temps.
>
> Ask if I haven't been clear.
>
> Cheers,
>
>>
>> is nil. I'm trying this on 3.10gamma.
>>
>> Thanks -- Sophie
>>
>> renderNewModelButton: html
>> { M1. M2 } do:
>> [ : modelClass |
>> html submitButton
>> callback:
>> [ | newModel |
>> self session magma commit: [
>> newModel := self repository models add: modelClass new.
>> 1>> self halt] fixTemps.
>> self halt.
>> 2>> self call: (newModel viewerClass new model: newModel).
>> selectedModel := nil ] fixTemps;
>> value: #New , ' ' , modelClass name ]
>>
>>> Decompiler
>>> - Block closure - Don't Work (That should not take too long to fix it)
>>
>> That would unfortunately make it impossible for newbies like me to debug
>> etc.
>>
>>
>>
>>
>
> Mth
>
>
>
>
>
More information about the Squeak-dev
mailing list
|