Use of variables in patterns

Filip Konvička filip.konvicka.removethisantispamtoken at logis.cz
Mon Mar 13 12:53:06 CET 2006


> Kevin Glynn wrote:
>> I attach an expanded patch that also adds a compiler switch
>> (warnshadow). The patch checks for shadowings in the local environment
>> and the top level environment (see warnredecl).  Documentation isn't
>> fixed yet. 
> 
> That's good news!  But...
> 
>> Unfortunately there are still a few wrinkles, e.g.:
>>
>>   local X in try {Show h} finally {Show e} end end
>>
>> gives that X is shadowed, due to the expansion of finally.  there
>> are probably a few cases like this.
> 
> To me that should be considered a bug in the expansion of finally!  Do 
> you think you can fix the expansion to avoid that clash?  Expansion of 
> language constructs should always use brand new identificators...

Yes, the problem seems to be at Unnester.oz:2418, but the code is not 
commented so I could not find a quick solution to this other than 
renaming the variable from X to say Unnester_oz_2418_Exception_Pattern ;-)

>> functor
>> import
>>    RecordC(width: WidthC)
>> ......
>>
>> reports WidthC to be shadowed.  
> 
> This is correct if WidthC is available in the base environment. 
> Otherwise it's a bug.
> 
>> However,  I think the option is great and will help a lot.  Lets get
>> rid of
>>
>>   case S of suspended(S) then {Deref S} else S end
>>
>> forever!
> 
> I agree.  But it must at least be correct, otherwise it will be more 
> irritating than useful!  This thing looks much more useful than the 
> detection of unused identifiers, which I personally find irritating...
> 

Well, it is rather irritating, but sometimes it would help find some 
shadowing problems. Which should be history now :-)

Cheers,
Filip




More information about the mozart-users mailing list