Why does this happen?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why does this happen?

Costas Menico
1) When I put the ##() in to the dictionary I get a strange answer.

x:=Dictionary new
x at: 'element' put:  ##(1. 2. 3. [2]).      answer---> 1. 2. 3. [2]).

I was expecting just a [2]

2) Also when I at:put: a block I get a strange answer.

x at: 'element' put:  [3]       answer---> x at: 'element' put:  [3]

I was expecting just a [3]


I am trying to understand the reasoning but can' come up with anything
that makes sense. Is this normal or a quirk?

Costas Menico


Reply | Threaded
Open this post in threaded view
|

Re: Why does this happen?

Davorin Rusevljan-2
>1) When I put the ##() in to the dictionary I get a strange answer.
>
>x:=Dictionary new
>x at: 'element' put:  ##(1. 2. 3. [2]).      answer---> 1. 2. 3. [2]).
>
>I was expecting just a [2]
>
>2) Also when I at:put: a block I get a strange answer.
>
>x at: 'element' put:  [3]       answer---> x at: 'element' put:  [3]
>
>I was expecting just a [3]


I think it is because prinString for blockClosures is a bit slopy, so it
displays more source than needed. If you inspect your results, you will see
that results are as you have expected them to be.

Davorin Rusevljan