Bug in BlockContext ?

Samir Saidani saidani at info.unicaen.fr
Thu Feb 17 15:31:22 UTC 2005


Thank you very much, it is really more clear ! Ok, now I understand
that using blocks can change the classic behaviour of variables
assignment.

a := 2. 
b := a. 
a := 1.  
b value. 
gives 2

But:

a := 2.
b := [a].
a := 1.
b value.

gives 1

and

a := 2.
b := [a] fixTemps.
a := 1.
b value.

gives also 1

but

|a|
a := 2.
b := [a] fixTemps.
a := 1.
b value.

gives 2

So without the fixTemps and the allocation of a temporary variable,
the block takes the latest value for this own context, which is quite
unexpected. But I thought that the allocation was done automatically
by the language, why do we have to add |a| ? There is not
automatically |a b| when you don't state it ? And why BlockContext
does not include by default the fixTemps feature ? This is quite
annoying to be aware of such unuseful things, no ? I read in the
roadmap 3.9 that block closure will be supported, and if it allows us
to get rid of this kind of stuff, this would be great !

Cheers,
Samir

Yar Hwee Boon <hboon at motionobj.com> writes:

> On 17-Feb-05, at PM 10:10, Samir Saidani wrote:
>
>> But it seems that we don't need fixTemps for this kind of stuff, this
>> example works perfectly without. For sure, the fixTemps effect is not
>> clear for me,
>
> Try the following (note that the |a| is important) in a workspace to
> see the effect of #fixTemps:
>
> ====
> |a|
> a := 1.
> b1 := [a].
> b2 := [a] fixTemps.
> a := 3.
> b1 value + b2 value
> ====
>
> --
> HweeBoon
> MotionObj
> (65) 6764-9774
>
>
>

-- 
Samir SAIDANI				
PhD Student in CS / Doctorant en informatique 	web : http://www.info.unicaen.fr/~saidani
Universite de Caen - Laboratoire GREYC          tel : 02-31-56-74-30
Equipe MAD - Campus II - 14032 Caen Cedex       fax : 02-31-56-76-30



More information about the Squeak-dev mailing list