# \$B%V%m%C%/0z?t\$H3g8L!&0z?t\$J\$7(Bsuper

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

e\$B%a%=%C%I\$N0z?t\$KBeF~\$7\$?>l9g!“3g8L!&0z?t\$J\$7e(Bsupere\$B\$G\$OBeF~8e\$NCM\$,%9!<%Q!<%/%i%9\$Ne(B
e\$B%a%=%C%I\$KEO\$5\$l\$^\$9\$,!”%V%m%C%/0z?t\$N>l9g\$O\$b\$H\$N%V%m%C%/\$,EO\$5\$l\$k\$h\$&\$G\$9!#e(B

— t.rb
class A
def foo(x, *y, &z)
p x #=> 4
p y #=> [5, 6, 7]
z.call #=> original block
end
end

class B < A
def foo(x, *y, &z)
x = 4
y = [5, 6, 7]
z = lambda { puts “replaced block” }
super
end
end

## B.new.foo(1, 2, 3) { puts “original block” }

\$ ruby-1_8 -v t.rb
ruby 1.8.7p5000 (2009-02-26 revision 22644) [i686-linux]
4
[5, 6, 7]
original block
\$ ruby-trunk -v t.rb
ruby 1.9.2dev (2009-02-03 trunk 21996) [i686-linux]
4
[5, 6, 7]
original block

e\$B\$3\$l\$O0U?^\$5\$l\$?5sF0\$G\$7\$g\$&\$+!#e(B

[email protected]\$G\$9!%e(B

Yukihiro M. wrote::

|e\$B%a%=%C%I\$N0z?t\$KBeF~\$7\$?>l9g!“3g8L!&0z?t\$J\$7e(Bsupere\$B\$G\$OBeF~8e\$NCM\$,%9!<%Q!<%/%i%9\$Ne(B
|e\$B%a%=%C%I\$KEO\$5\$l\$^\$9\$,!”%V%m%C%/0z?t\$N>l9g\$O\$b\$H\$N%V%m%C%/\$,EO\$5\$l\$k\$h\$&\$G\$9!#e(B

e\$B\$G\$9\$M!#e(B

|e\$B\$3\$l\$O0U?^\$5\$l\$?5sF0\$G\$7\$g\$&\$+!#e(B

e\$B!!\$=\$&\$\$\$&;EMM\$r0U<1\$7\$F:n\$j\$^\$7\$?!%e(B

e\$B!!;EMM\$,\$I\$&\$G\$"\$k\$Y\$-\$+\$O!\$\$A\$g\$C\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G\$9\$+\$M!#\$b\$&\$A\$g\$C\$H%7%s%W%k\$J<BAu\$K\$9\$l\$P\$h\$+\$Ce(B
e\$B\$?\$N\$+\$b\$7\$l\$^\$;\$s\$,!#e(B

e\$B0z?t\$KBeF~\$9\$k\$3\$H<+BN\$,\$h\$\$%9%?%\$%k\$G\$O\$J\$\$\$H;W\$\$\$^\$9\$7!"e([email protected]<(E*\$K%V%m%C%/\$d%V%m%C%/0z?t\$rEO\$9\$3\$H\$,\$G\$-\$^\$9\$N\$G!“FC\$K:#\$N5sF0\$GITET9g\$O\$”\$j\$^\$;\$s!#e(B
e\$B6/[email protected]\$([email protected]\$NLdBj\$/\$i\$\$\$G\$9\$M!#e(B

[email protected]\$G\$9!%e(B

Shugo M. wrote::

e\$B0z?t\$KBeF~\$9\$k\$3\$H<+BN\$,\$h\$\$%9%?%\$%k\$G\$O\$J\$\$\$H;W\$\$\$^\$9\$7!"e([email protected]<(E*\$K%V%m%C%/\$d%V%m%C%/0z?t\$rEO\$9\$3\$H\$,\$G\$-\$^\$9\$N\$G!“FC\$K:#\$N5sF0\$GITET9g\$O\$”\$j\$^\$;\$s!#e(B
e\$B6/[email protected]\$([email protected]\$NLdBj\$/\$i\$\$\$G\$9\$M!#e(B

e\$B!!\$"\$H!\$:#\$Oe(B super{}
e\$B\$G%V%m%C%/[email protected]\$1JL\$KEO\$;\$k\$C\$F\$N\$,=q\$1\$k\$s\$G\$9\$M!%;He(B
e\$B\$&?M\$,\$\$\$k\$N\$+\$h\$/\$o\$+\$j\$^\$;\$s\$,!%e(B

e\$B!!\$"!\$HyL/\$K5sF0\$,0c\$C\$?!%e(B

class C
def foo(a, *b, &c)
p [“C#foo”, a, b, c]
yield
end
end

class D < C
def foo(a, *b, &c)
b = :xyzzy
super{
p “D”
}
end
end

D.new.foo(1){p :top}
D.new.foo(1, 2){p :top}
D.new.foo(1, 2, 3){p :top}
ruby 1.8.7 (2008-12-11 revision 20371) [i386-mswin32_90]
[“C#foo”, 1, [], #Proc:[email protected]:12]
“D”
[“C#foo”, 1, [:xyzzy], #Proc:[email protected]:12]
“D”
[“C#foo”, 1, [:xyzzy], #Proc:[email protected]:12]
“D”

ruby 1.9.1p0 (2009-02-02 revision 21960) [i386-mswin32_90]
[“C#foo”, 1, [:xyzzy], #Proc:[email protected]:12]
“D”
[“C#foo”, 1, [:xyzzy], #Proc:[email protected]:12]
“D”
[“C#foo”, 1, [:xyzzy], #Proc:[email protected]:12]
“D”

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

2009/03/03 10:05 SASADA Koichi [email protected]:

e\$B\$"\$H!\$:#\$Oe(B super{} e\$B\$G%V%m%C%/[email protected]\$1JL\$KEO\$;\$k\$C\$F\$N\$,=q\$1\$k\$s\$G\$9\$M!%;He(B
e\$B\$&?M\$,\$\$\$k\$N\$+\$h\$/\$o\$+\$j\$^\$;\$s\$,!%e(B

e\$B\$"!\$HyL/\$K5sF0\$,0c\$C\$?!%e(B

e\$B\$`!#e(B

e\$B\$3\$l\$C\$F%V%m%C%/\$O4X78\$J\$\$\$s\$8\$c\$J\$\$\$G\$9\$+e(B?

— t.rb
class A
def foo(*x)
p x
end
end

## class B < A def foo(*x) x = 1 super end end B.new.foo B.new.foo(2)

defiant:~\$ ruby-1_8 -v t.rb
ruby 1.8.7p5000 (2009-02-26 revision 22644) [i686-linux]
[]
[1]
defiant:~\$ ruby-trunk -v t.rb
ruby 1.9.2dev (2009-02-03 trunk 21999) [i686-linux]
[1]
[1]

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

2009/03/03 18:42 Yukihiro M. [email protected]:

|e\$B0z?t\$KBeF~\$9\$k\$3\$H<+BN\$,\$h\$\$%9%?%\$%k\$G\$O\$J\$\$\$H;W\$\$\$^\$9\$7!"e([email protected]<(E*\$K%V%m%C%/\$d%V%m%C%/0z?t\$rEO\$9\$3\$H\$,\$G\$-\$^\$9\$N\$G!“FC\$K:#\$N5sF0\$GITET9g\$O\$”\$j\$^\$;\$s!#e(B
|e\$B6/[email protected]\$([email protected]\$NLdBj\$/\$i\$\$\$G\$9\$M!#e(B

e\$B;EMME*\$K\$O!V0z?t\$X\$NBeF~\$r6X;_\$7\$F\$b\$h\$\$!W\$H\$9\$k\$H!"BeF~\$7\$?e(B
e\$B7k2L\$O<+F0E*\$K<BAu0MB8\$K\$J\$k\$H\$\$\$&%&%k%H%i#C\$b9M\$(\$i\$l\$^\$9\$M!#e(B

e\$B\$=\$l\$O\$A\$g\$C\$H\$d\$j\$9\$.\$J\$N\$G\$O!D!#e(B

e\$B0z?t\$X\$NBeF~\$O\$h\$/\$J\$\$%9%?%\$%[email protected]\$H\$O;W\$\$\$^\$9\$,!"\$+\$H\$\$\$C\$F6X;_\$7\$A\$c\$&\$N\$Oe(B
Rubye\$B\$C\$]\$/\$J\$\$5\$\$,\$7\$^\$9\$M\$(!#e(B

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

In message “Re: [ruby-dev:38115] Re:
e\$B%V%m%C%/0z?t\$H3g8L!&0z?t\$J\$7e(Bsuper”
on Tue, 3 Mar 2009 09:33:52 +0900, Shugo M. [email protected]
writes:

|e\$B0z?t\$KBeF~\$9\$k\$3\$H<+BN\$,\$h\$\$%9%?%\$%k\$G\$O\$J\$\$\$H;W\$\$\$^\$9\$7!"e([email protected]<(E*\$K%V%m%C%/\$d%V%m%C%/0z?t\$rEO\$9\$3\$H\$,\$G\$-\$^\$9\$N\$G!“FC\$K:#\$N5sF0\$GITET9g\$O\$”\$j\$^\$;\$s!#e(B
|e\$B6/[email protected]\$([email protected]\$NLdBj\$/\$i\$\$\$G\$9\$M!#e(B

e\$B;EMME*\$K\$O!V0z?t\$X\$NBeF~\$r6X;_\$7\$F\$b\$h\$\$!W\$H\$9\$k\$H!"BeF~\$7\$?e(B
e\$B7k2L\$O<+F0E*\$K<BAu0MB8\$K\$J\$k\$H\$\$\$&%&%k%H%i#C\$b9M\$(\$i\$l\$^\$9\$M!#e(B

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

In message “Re: [ruby-dev:38117] Re:
e\$B%V%m%C%/0z?t\$H3g8L!&0z?t\$J\$7e(Bsuper”
on Tue, 3 Mar 2009 12:17:22 +0900, Shugo M. [email protected]
writes:

|e\$B\$3\$l\$C\$F%V%m%C%/\$O4X78\$J\$\$\$s\$8\$c\$J\$\$\$G\$9\$+e(B?
|
|— t.rb
|class A
| def foo(*x)
| p x
| end
|end
|
|class B < A
| def foo(*x)
| x = 1
| super
| end
|end
|B.new.foo

B.new.foo(2)
defiant:~\$ ruby-1_8 -v t.rb
ruby 1.8.7p5000 (2009-02-26 revision 22644) [i686-linux]
[]
[1]

e\$B\$3\$C\$A\$,%P%0\$G\$7\$g\$&\$M!#e(B1.8e\$B\$rD>\$7\$^\$9!#e(B

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

2009/03/04 18:50 Yukihiro M. [email protected]:

|> e\$B;EMME*\$K\$O!V0z?t\$X\$NBeF~\$r6X;\$7\$F\$b\$h\$\$!W\$H\$9\$k\$H!“BeF~\$7\$?e(B
|> e\$B7k2L\$O<+F0E*\$K<BAu0MB8\$K\$J\$k\$H\$\$\$&%&%k%H%i#C\$b9M\$(\$i\$l\$^\$9\$M!#e(B
|
|e\$B\$=\$l\$O\$A\$g\$C\$H\$d\$j\$9\$.\$J\$N\$G\$O!D!#e(B
|
|e\$B0z?t\$X\$NBeF~\$O\$h\$/\$J\$\$%9%?%\$%[email protected]\$H\$O;W\$\$\$^\$9\$,!”\$+\$H\$\$\$C\$F6X;
\$7\$A\$c\$&\$N\$Oe(B
|Rubye\$B\$C\$]\$/\$J\$\$5\$\$,\$7\$^\$9\$M\$(!#e(B

e\$B\$I\$&\$J\$s\$G\$7\$g\$&\$M!#!V6X;\$7\$F\$b\$h\$\$!W\$J\$N\$G!"6X;\$7\$J\$/\$F\$be(B
e\$B\$h\$\$!"\$D\$^\$j8=>u\$bG’\$a\$i\$l\$k\$o\$1\$G\$9\$,!#e(B

e\$B\$O\$\$!"\$=\$l\$OM}2r\$7\$F\$\$\$^\$9\$,!“0z?t\$X\$NBeF~\$r6X;_\$9\$k\$h\$&\$J=hM}7O\$re(B
Rubye\$B\$N=hM}[email protected]\$C\$F\$\$\$\$\$N\$+\$J\$”!D\$H!#e(B
e\$B\$\$\$d!"\$^\$D\$b\$H\$5\$s\$,[email protected]\$(\$P!"[email protected]\$H;W\$\$\$^\$9\$,!#e(B

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

In message “Re: [ruby-dev:38132] Re:
e\$B%V%m%C%/0z?t\$H3g8L!&0z?t\$J\$7e(Bsuper”
on Wed, 4 Mar 2009 18:46:20 +0900, Shugo M. [email protected]
writes:

|> e\$B;EMME*\$K\$O!V0z?t\$X\$NBeF~\$r6X;\$7\$F\$b\$h\$\$!W\$H\$9\$k\$H!“BeF~\$7\$?e(B
|> e\$B7k2L\$O<+F0E*\$K<BAu0MB8\$K\$J\$k\$H\$\$\$&%&%k%H%i#C\$b9M\$(\$i\$l\$^\$9\$M!#e(B
|
|e\$B\$=\$l\$O\$A\$g\$C\$H\$d\$j\$9\$.\$J\$N\$G\$O!D!#e(B
|
|e\$B0z?t\$X\$NBeF~\$O\$h\$/\$J\$\$%9%?%\$%[email protected]\$H\$O;W\$\$\$^\$9\$,!”\$+\$H\$\$\$C\$F6X;
\$7\$A\$c\$&\$N\$Oe(B
|Rubye\$B\$C\$]\$/\$J\$\$5\$\$,\$7\$^\$9\$M\$(!#e(B

e\$B\$I\$&\$J\$s\$G\$7\$g\$&\$M!#!V6X;\$7\$F\$b\$h\$\$!W\$J\$N\$G!"6X;\$7\$J\$/\$F\$be(B
e\$B\$h\$\$!"\$D\$^\$j8=>u\$bG’\$a\$i\$l\$k\$o\$1\$G\$9\$,!#e(B

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

In message “Re: [ruby-dev:38133] Re:
e\$B%V%m%C%/0z?t\$H3g8L!&0z?t\$J\$7e(Bsuper”
on Wed, 4 Mar 2009 18:49:02 +0900, Yukihiro M.
[email protected] writes:

||e\$B\$3\$l\$C\$F%V%m%C%/\$O4X78\$J\$\$\$s\$8\$c\$J\$\$\$G\$9\$+e(B?
||
||— t.rb
||class A
|| def foo(*x)
|| p x
|| end
||end
||
||class B < A
|| def foo(*x)
|| x = 1
|| super
|| end
||end
||B.new.foo
||B.new.foo(2)
||—
||
||defiant:~\$ ruby-1_8 -v t.rb
||ruby 1.8.7p5000 (2009-02-26 revision 22644) [i686-linux]
||[]
||[1]
|
|e\$B\$3\$C\$A\$,%P%0\$G\$7\$g\$&\$M!#e(B1.8e\$B\$rD>\$7\$^\$9!#e(B

e\$B\$h\$&\$d\$/8+\$F\$_\$^\$7\$?!#\$J\$s\$He(B1.8e\$B\$G\$O%a%=%C%IK\BN\$NI>2ACf\$K\$Ke(B
reste\$B0z?t\$N>pJs\$,Mh\$F\$^\$;\$s!#\$H\$\$\$&\$3\$H\$G!"8=>u\$N\$^\$^\$G\$Oe(Brest
e\$B0z?t\$N=q\$-49\$(\$rEAHB\$9\$k\$3\$H\$OIT2DG=\$G\$9!#e(B

e\$B\$b\$A\$m\$s!“e(Bruby_framee\$B\$+e(Bruby_scopee\$B\$K\$=\$lAj1~\$N>pJs\$rDI2C\$7\$F\$de(B
e\$B\$l\$P\$\$\$\$\$N\$G\$9\$,!”\$"\$^\$j?d>)\$5\$l\$J\$\$%9%?%\$%k\$r<B8=\$9\$k\$?\$a\$Ke(B
e\$B%3%9%H\$+\$1\$k\$N\$O\$"\$s\$^\$j\$d\$j\$?\$/\$J\$\$\$J\$"!#e(B

e\$B\$I\$&[email protected]\$+!#e(B

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.