[Pharo-project] about OutOfScopeNotification
stephane.ducasse at inria.fr
Mon Nov 15 10:56:56 CET 2010
> IMO, it should not raise an error, at maximum it should just warn that
> global name are shadowed by nested scope. It should compile.
>> | b c |
>> b := [ :Object | Object ].
>> c := b value: Object.
>> is something that I would rather not have compile. Perhaps it should, just as one is free to evaluate
>> Object := 'this is really a bad idea to evaluate'.
>> but the latter is at least akin to shooting one's foot with a clearly-marked weapon. Using Object as a temp name is not something that I can ever see as a good idea, but assignments to globals have uses.
> The point is, that its not important what name you are using. It is
> about a strictness of compiler, and about whether we need
> to check for any identifier declared in local scope (such as class
> scope, method scope, block scope) clashing with any names defined in
> outer scope.
> My point that shadowing should be allowed. And we have a Lint there
> for pointing out on such clashes.
> It is pointless to enforce strictness, because it works only in one
> way: when an outer scope name defined before inner scoped name.
> But what if you wrote a method which using some name(s), it compiled
> well, and works. But then later you loaded some external package,
> which defines a global var with same name. Should your method stop
> compiling? I don't think so.
More information about the Pharo-project