New() &block

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

e$B%P%0$J$N$+;EMM$J$N$+NI$/$o$+$i$J$$$N$G$9$,e(B,

#–
class Foo
def Foo.new(&block)
super
end

def Foo.foo(&block)
new() &block
end
end

Foo.foo
#–

e$B$r<B9T$9$k$He(B

tmp/test.rb:8:in foo': undefined method&’ for #Foo:0x40218578
(NoMethodError)

e$B$H$N%(%i!<$,=P$^$9e(B.

newe$B$NBe$o$j$KDL>o$N%a%=%C%I$J$iEvA3%(%i!<$O=P$^$;$se(B.
e$B$3$l$C$Fe(B, e$B%P%0$Je(B
e$B$N$G$7$g$&$+e(B? e$B$=$l$H$b;EMMe(B?

e$B$A$J$_$Ke(B, ruby 1.8, 1.9 e$BN>J}$H$bF1$88=>]$G$9e(B.

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—

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

In message “Re: [ruby-dev:30702] new() &block”
on Mon, 9 Apr 2007 22:26:37 +0900, [email protected] (Keiju
ISHITSUKA) writes:

|e$B%P%0$J$N$+;EMM$J$N$+NI$/$o$+$i$J$$$N$G$9$,e(B,

e$B$J$K$,$7$?$$$N$,?dB,$9$k$7$+$J$$$N$G$9$,!"e(B

| def Foo.foo(&block)
| new() &block
| end

e$B$3$NItJ,!"e(B

new() &block

e$B$Oe(B

new() & block

e$B$H$$$&0UL#$G!"$D$^$j!"!Ve(BFoo.newe$B$G?7$7$$e(BFooe$B%%V%8%’%/%H$r:n$j!"e(B
e$B$=$l$Ke(B & e$B1i;;;R$rE,MQ!W$H$$$&0UL#$K$J$j$^$9!#$
$=$i$/$Oe(B

new(&block)

[email protected];W$$$^$9$,!"$I$&$G$7$g$&!#e(BJavae$B$"$?$j$KFG$5e(B
e$B$l$9$.$?!)e(B

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

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev:30703] the message: “[ruby-dev:30703] Re: new() &block”,
on Apr/09 23:45(JST) Yukihiro M. writes:

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

new() & block

e$B$H$$$&0UL#$G!"$D$^$j!"!Ve(BFoo.newe$B$G?7$7$$e(BFooe$B%%V%8%’%/%H$r:n$j!"e(B
e$B$=$l$Ke(B & e$B1i;;;R$rE,MQ!W$H$$$&0UL#$K$J$j$^$9!#$
$=$i$/$Oe(B

new(&block)

[email protected];W$$$^$9$,!"$I$&$G$7$g$&!#e(BJavae$B$"$?$j$KFG$5e(B
e$B$l$9$.$?!)e(B

e$B$$$d!<e(B. e$BC1$J$k4*0c$$$G$9e(B.

foo &block

[email protected]$He(B, e$B%V%m%C%/EO$7$K$J$C$F$$$?$N$Ge(B,
e$B3g8L$N30$KCV$/[email protected]$H4*0c$$%b!<%Ie(B
e$B$KF~$C$F$$$^$7$?e(B.

e$B$*<j?t$+$1$^$7$?e(B(__;;

__
---------------------------------------------------->> [email protected](B
e$B7=<ye(B <<—
---------------------------------->> e-mail: [email protected] <<—