[GemStone-Smalltalk] Variables and block closure

Pierre CHANSON via GemStone-Smalltalk gemstone-smalltalk at lists.gemtalksystems.com
Tue Mar 17 12:02:53 PDT 2015


Thanks James,

ok I am working on an older version, not even the last one. So here is a
very good reason I should upgrade to the last version as soon as it is
released. That will be some work.

by the way my previous code example did not had any sense. This is the good
one (if someone read it) and it is the same problem:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[| traversal array result|
traversal := nil.
result := OrderedCollection new.
traversal := [ :a :r |
    |rtemp|
    a do: [ :e | (e isArray) ifTrue: [ rtemp := OrderedCollection new. r
add: rtemp. traversal value: e value: rtemp] ifFalse: [ r add: e asString ]
] ].
array :=  Array with: (Array with: 1 with: 4) with: #ok with: (Array with:
#henry).
traversal value: array value: result.
result.
] on: Error do: [:evt | evt asString]
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Cheers,

Pierre

2015-03-17 15:52 GMT-03:00 James Foster <james.foster at gemtalksystems.com>:

> There are some bugs in the way blocks handle variables in GemStone/S
> 64-bit 3.2.x (and possibly earlier; you don’t mention your version) that
> will be fixed in 3.3 (but probably not before; this is described internally
> with bug #45059).
>
> James
>
> > On Mar 17, 2015, at 11:17 AM, Pierre CHANSON via GemStone-Smalltalk <
> gemstone-smalltalk at lists.gemtalksystems.com> wrote:
> >
> > Hi everyone,
> >
> > I wonder why is that two expressions are not evaluated similarly by
> Gemstone, but they are by Pharo ?
> >
> > The second one is the one I would like to be working like the first one
> is, in Gemstone.
> >
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> > [ | traversal array|
> > traversal := [ :a | a do: [ :e | (e isArray) ifTrue: [ traversal value:
> e ] ifFalse: [ e asString ] ] ].
> > array := Array with: (Array with: 1 with: 4) with: #ok with: (Array
> with: #henry).
> > traversal value: array.
> > ] on: Error do: [:evt | evt asString]
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> >
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> > | traversal array|
> > [ traversal := [ :a | a do: [ :e | (e isArray) ifTrue: [ traversal
> value: e ] ifFalse: [ e asString ] ] ].
> > array := Array with: (Array with: 1 with: 4) with: #ok with: (Array
> with: #henry).
> > traversal value: array.
> > ] on: Error do: [:evt | evt asString]
> > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> >
> > Thank you,
> >
> > Pierre
> >
> > _______________________________________________
> > GemStone-Smalltalk mailing list
> > GemStone-Smalltalk at lists.gemtalksystems.com
> > http://lists.gemtalksystems.com/mailman/listinfo/gemstone-smalltalk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/gemstone-smalltalk/attachments/20150317/d4aa6c80/attachment.html>


More information about the GemStone-Smalltalk mailing list