[Pharo-dev] Is variable shadowing a feature or a bug?

Frank Shearar frank.shearar at gmail.com
Thu Dec 12 09:48:05 EST 2013


On 12 December 2013 14:44, Benjamin
<Benjamin.VanRyseghem.Pharo at gmail.com> wrote:
> I just discovered that in Pharo 3 you can do:
>
> [ :bool |
> self logCr: bool.
> bool := false.
> self logCr: bool.
> ] value: true
>
> Is this a bug or a feature ?

That's not a shadow, from what I can see? It is an
assign-to-a-block-argument, which I'd frown upon.

| bool |
bool := true.
[:bool | "<-- shadow!"
  self logCr: bool] value: bool

is a shadow.

Unless I'm missing something?

frank

> I am fighting with this every day in javascript, and I do not know about to
> feel about this :s
>
> Ben
>




More information about the Pharo-dev mailing list