:= operator

e$B!!$5$5$@$G$9!#e(B

e$B!!e(B:=
e$B$C$F%*%Z%l!<%?$C$F8@$o$J$$$N$+$J!#$h$/$o$+$i$J$$$s$G!"$b$70c$C$F$$e(B
e$B$?$i$h$jE,@Z$J8@$$J}$r65$($F$/$@$5$$!#e(B

e$B!!e(B[Ruby] local variables new scoping rule
e$B!!e(Bhttp://www.rubyist.net/~matz/20070112.html#p04

e$B$rFI$s$@$N$G$9$,!"e(B|foo; bar| e$B0J30$Ke(B :=
e$B$H$7$F%V%m%C%/%m!<%+%k$JJQ?t$r@ke(B
e$B8@$9$kJ}K!$rMQ0U$9$kI,MW@-$,$h$/$o$+$j$^$;$s$G$7$?!#e(B

e$B$7$+$7!"%V%m%C%/8BDj$N%m!<%+%kJQ?t$r;H$$$?$$6ILL$O8BDj$5$l$F$$j!"%O%Ue(B
e$B%^%s05=LE
8+CO$+$i$O!"$h$jIQHK$K;H$o$l$kDL>o$N%m!<%+%kJQ?tE*;H$$J}$N$?$ae(B
e$B$K!"$$$A$$$A%V%m%C%/$NA0$KLa$C$F@k8@E*BeF~$,I,?$H8@$&$N$O$a$s$I$/$5$$!#e(B

e$B!!$&!<$s!"$=$&$J$s$G$9$+$M$’!#8BDj$5$l$?MQES$N$?$a$K!"e(B:=
e$B$H$$$&5-9f$,A}e(B
e$B$($k$[$&$,$a$s$I$/$5$$!J3P$($k$N$,!K$H;W$$$^$9!#e(B

e$B!!$"$H!"e(B

a = 1
iter{
a = 2
a := 3
a = 4
}
p a

e$B!!Nc$($P$3$N>l9g$C$F2?$,JV$k$s$G$7$g$&!#e(BJavaScripte$BE*$K$Oe(B1e$B!"e(BC++e$BE*$K$Oe(B2e$B!"e(B
e$BBg7j$Oe(B4e$B!#e(B

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

In message “Re: [ruby-dev:30159] := operator”
on Tue, 23 Jan 2007 12:27:24 +0900, SASADA Koichi [email protected]
writes:

|e$B!!e(B:= e$B$C$F%*%Z%l!<%?$C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9$M!#$7$+$7!"e(BJavaScripte$B$O$*$+$7$$$h$M!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

e$BA0ED$G$9!#e(B

Yukihiro M. wrote:

|e$B!!$3$l$OG<F@$7$^$7$?!#$d$C$Q$j!"%V%m%C%/%m!<%+%kJQ?t$N!V@k8@!W$,2?$i$+$Ne(B
|e$B7A$GI,MW$K$J$C$A$c$&$C$F$3$H$G$9$h$M!#e(B

e$B$=$&$$$&$3$H$G$9!#$G!"$b$H$b$HBeF~$r@k8@$NBe$o$j$K;H$C$F$$$?e(B
e$B$N$G!"?7$7$$!V@k8@!W$b$J$s$i$+$NBeF~1i;;;R$,NI$$$H;W$$$^$9!#e(B

e$B;d$be(Bvare$B$h$j$Oe(BRubye$B$NJ8K!$K$J$8$`$h$&$K;W$$$^$9!#e(B

e$B!Ve(B:=e$B!W0J30$N%"%$%G%#%"$,$"$l$P;29M$K$7$^$9!#e(B

Pascale$B$H$+$NBeF~$H:.Mp$5$l$k$H$$$&$N$OFqE@$+$b$7$l$J$$$G$9$M!#e(B

Sathere$B$_$?$$$Ke(B::=e$B$@$H:.F1$5$l$J$$$h$&$J5$$O$7$^$9$,!“e(BSathere$B$OIaDL$Ne(B
e$BBeF~$,e(B:=e$B$J$N$G!”$d$O$je(BRubye$BE*$K$Oe(B:=e$B$NJ}$,E,@Z$K;W$$$^$9!#e(B
e$B$H$$$&$o$1$G!"e(B:=e$B$K0lI<!#e(B

e$B$H$3$m$G!"e(B:=e$B$G$b$d$O$j30B&$N%9%3!<%W$NJQ?t$Ne(Bhidee$B$O5v$5$l$F$7$^$&e(B
e$B$N$G$7$g$&$+e(B?

e$B$7$D$3$/$F$9$_$^$;$s!#e(B

e$B!!$5$5$@$G$9!#e(B

Yukihiro M. wrote:

|e$B!!e(B[Ruby] local variables new scoping rule
|e$B!!e(Bhttp://www.rubyist.net/~matz/20070112.html#p04
|
|e$B$rFI$s$@$N$G$9$,!"e(B|foo; bar| e$B0J30$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 Jan 2007 13:03:23 +0900, SASADA Koichi [email protected]
writes:

|e$B!!$&!<$s!#$;$a$Fe(B var a e$B$N$[$&$,!"8D?ME*$K$O$$$$$s$G$9$,!#e(BRuby e$BE*$K$O$=$Ce(B
|e$B$A$N$[$&$,%-%b%$$+$J!#e(B

e$B$?$V$s!#$“$H!”$"$s$^$jM=Ls8lA}$d$7$?$/$J$$$G$9!#e(B

|e$B!!$3$l$OG<F@$7$^$7$?!#$d$C$Q$j!"%V%m%C%/%m!<%+%kJQ?t$N!V@k8@!W$,2?$i$+$Ne(B
|e$B7A$GI,MW$K$J$C$A$c$&$C$F$3$H$G$9$h$M!#e(B

e$B$=$&$$$&$3$H$G$9!#$G!“$b$H$b$HBeF~$r@k8@$NBe$o$j$K;H$C$F$$$?e(B
e$B$N$G!”?7$7$$!V@k8@!W$b$J$s$i$+$NBeF~1i;;;R$,NI$$$H;W$$$^$9!#e(B
e$B!Ve(B:=e$B!W0J30$N%“%$%G%#%”$,$"$l$P;29M$K$7$^$9!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)

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

In message “Re: [ruby-dev:30185] Re: := operator”
on Thu, 25 Jan 2007 10:37:08 +0900, Shugo M.
[email protected] writes:

|e$B$H$$$&$o$1$G!"e(B:=e$B$K0lI<!#e(B

e$B$I$&$b!#e(B

|e$B$H$3$m$G!"e(B:=e$B$G$b$d$O$j30B&$N%9%3!<%W$NJQ?t$Ne(Bhidee$B$O5v$5$l$F$7$^$&e(B
|e$B$N$G$7$g$&$+e(B?

-ve$B$G7Y9p$,=P$^$9!#6X;_$K$7$A$c$&$H%3!<%I$N0\F0;~$KKh2s=EJ#$re(B
e$B9MN8$9$kI,MW$,$“$k$N$G!”%+%8%e%“%k$JJT=8$N;~$K$O$7$s$I$$$+e(B
e$B$J!”$H!#e(B

e$B$?$1e(B(tk)e$B$G$9e(B

e$B$"$N!&!&!Ve(Brubye$B$G$OJQ?t$N7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N30B&$Ne(Bxe$B$r0U?^$;$:$K=q$-$+$($F$7$^$&!”$H$$$C$?e(B
e$B$3$H$,9M$($i$l$^$9!#e(B

e$B$=$l$O$=$l$H$7$F!"e(B:=e$B$N$h$&$JL@<(E*$J@k8@$,F3F~$5$l$k$J$i!"e(Bfore$B$J$I$be(B
e$B?7$7$$%9%3!<%W$rF3F~$9$k$h$&$K$7$F$b$$$$$+$b$7$l$J$$$G$9$M!#e(B

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

In message “Re: [ruby-dev:30187] Re: := operator”
on Thu, 25 Jan 2007 19:58:00 +0900, take_tk [email protected]
writes:

|e$B$"$N!&!&!Ve(Brubye$B$G$OJQ?t$N7A$r8+$l$P%9%3!<%W$NHO0O$,J,$+$k!W$H$$$&$h$&$K$Oe(B
|e$B$7$J$$$s$G$9$+!)e(B

e$BM-8zHO0O$,%V%m%C%/$@$m$&$,%a%=%C%I$@$m$&$,!"%m!<%+%kJQ?t$G$“e(B
e$B$k$3$H$OF1$8$G$9$+$i!”$H$$$&$N$,;d$N8+2r$G$9!#e(B