> >
 > > There have been many requests that the compiler should
 > > warn about this kind of variable shadowing....
 > >
> > Maybe Oz 1.3.2 will offer this particular improvement ? >
If someone sends a patch ! (It is in the bug database as PR# 1707)

Here it is, I think that it does what we need. But I think that some cmdline and GUI switches should be added to make sure that people can switch this off (e.g. during "make bootstrap" :-)).

Cheers,
Filip

Index: BindingAnalysis.oz
===================================================================
RCS file: /services/mozart/CVS/mozart/share/lib/compiler/BindingAnalysis.oz,v
retrieving revision 1.17
diff -u -p -r1.17 BindingAnalysis.oz
--- BindingAnalysis.oz  21 Jan 1999 10:00:42 -0000      1.17
+++ BindingAnalysis.oz  10 Mar 2006 13:53:34 -0000
@@ -67,6 +67,12 @@ in
         end
         X = {Dictionary.condGet D PrintName undeclared}
         case X of undeclared then NewTl in
+            if {Some @env fun {$ D#_#_} {Dictionary.member D PrintName} end} 
then
+               {self.MyReporter warn(coord: Coord
+                                     kind: BindingAnalysisWarning
+                                     msg: ('shadowing variable `'#
+                                           pn(PrintName)#'\''))}
+            end
            V = {New Core.userVariable init(PrintName Coord)}
            {Dictionary.put D PrintName V}
            Tl = V|NewTl
_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to