Shadowing outer local variable

e$B$k$S$-$A$G$9!#e(B

e$B7Y9p!Ve(Bshadowing outer local
variablee$B!W$O$J$/$9$Y$-$@$H;W$$$^$9!#e(B
e$B$=$b$=$b860x$Oe(B1.8e$B$^$G$N%V%m%C%/0z?t$N;EMM$,$R$I$+$C$?$+$i$G$9!#e(B
e$B7Y9p$r>C$9$K$Oe(B1.8e$B$^$GF1MM$?$H$(e(B1e$BJ8$N%V%m%C%/$G$"$C$F$be(B
e$B%V%m%C%/0z?t$NL>A0$rJQ99$7$J$$$H$$$1$J$/$J$j$^$9!#e(B
e$B$3$l$O$+$J$j%9%H%l%9$,$?$^$j$^$9!#e(B
e$BA1$70-$7$OJL$H$7$FF1$8JQ?tL>$r;H$&$N$Oe(BLispe$B$d#C8@8l$G$bIaDL$K9T$o$l$F$$$^$9!#e(B

e$B$`$7$m$3$N7Y9p$Oe(B1.8e$B$K$D$1$k$Y$-$G$9!#e(B

RUBY_VERSION # => “1.9.0”
RUBY_RELEASE_DATE # => “2008-02-20”
a = 1
b = [1,2].map{|a| a*2} # => [2, 4] # !> shadowing outer local
variable - a

(let ((a 1) b)
(setq b (mapcar (lambda (a) (* a 2)) '(1 2)))
(list a b)) ; => (1 (2 4))

diff -u /home/nobackup/compile/ruby19/parse.c.orig
/home/nobackup/compile/ruby19/parse.c
— /home/nobackup/compile/ruby19/parse.c.orig 2008-02-22
00:43:34.000000000 +0900
+++ /home/nobackup/compile/ruby19/parse.c 2008-02-22 00:42:47.000000000
+0900
@@ -12790,7 +12790,6 @@
yyerror(“duplicated argument name”);
}
else if (dvar_defined(name) || local_id(name)) {

  •  rb_warningS("shadowing outer local variable - %s", 
    

rb_id2name(name));
vtable_add(lvtbl->vars, name);
}
}

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:33891] shadowing outer local variable”
on Fri, 22 Feb 2008 00:46:10 +0900, [email protected] writes:

|e$B7Y9p!Ve(Bshadowing outer local variablee$B!W$O$J$/$9$Y$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