On 15 November 2010 00:13, Schwab,Wilhelm K <[email protected]> wrote: > Stef, > > Are you concerned that an error is raised, or over exactly which error is > raised? The code >
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. > Bill > > > ________________________________________ > From: [email protected] > [[email protected]] On Behalf Of Stéphane Ducasse > [[email protected]] > Sent: Sunday, November 14, 2010 4:57 PM > To: [email protected] Development > Subject: [Pharo-project] about OutOfScopeNotification > > Hi > > I was reading Issue 2436: Compiler outofScopeNotification > http://code.google.com/p/pharo/issues/detail?id=2436 > > which I integrated in 12240 > > and I still do not get why in Squeak or pharo now > > > | b c | > b := [ :Object | Object ]. > c := b value: Object. > > raises Unknown variable Object > > while > > | b c | > b := [ :x | x ]. > c := b value: Object. > > just returns Object > > Stef > > > -- Best regards, Igor Stasenko AKA sig.
