super w/ implicit arguments in Ruby 1.9

I

Intransition

Hi--

Debugging a library for 1.9.1 compatibility. I get this error:

6) Error:
test_02_002(TC_Inheritor_02):
RuntimeError: implicit argument passing of super from method defined
by define_method() is not supported. Specify all arguments
explicitly.

The offending code is:

define_method( key ) do
defined?(super) ? super.__send__(op,obj) : obj.dup
end

So I'm confused since I am not calling super without arguments, though
I am asking if it is defined. But #defined? works in a special way so
as not to actually invoke it's argument, right? Or is it something to
with __send__? What is amiss here?

Thanks.
 
R

Rob Biedenharn

Hi--

Debugging a library for 1.9.1 compatibility. I get this error:

6) Error:
test_02_002(TC_Inheritor_02):
RuntimeError: implicit argument passing of super from method defined
by define_method() is not supported. Specify all arguments
explicitly.

The offending code is:

define_method( key ) do
defined?(super) ? super.__send__(op,obj) : obj.dup
end

So I'm confused since I am not calling super without arguments, though
I am asking if it is defined. But #defined? works in a special way so
as not to actually invoke it's argument, right? Or is it something to
with __send__? What is amiss here?

Thanks.


read the line like the parser will:

defined?(super) ? (super).__send__((op),(obj)) : (obj).dup

the object that gets __send__ is the return value of super. Can you
try:
defined?(super) ? super().__send__(op,obj) : obj.dup
so that the implicit args of super aren't an issue? (because you
explicitly give an empty arg list)

-Rob


Rob Biedenharn http://agileconsultingllc.com
(e-mail address removed)
 
I

Intransition

read the line like the parser will:

=A0 =A0defined?(super) ? (super).__send__((op),(obj)) : (obj).dup

the object that gets __send__ is the return value of super. =A0Can you = =A0
try:
=A0 =A0defined?(super) ? super().__send__(op,obj) : obj.dup
so that the implicit args of super aren't an issue? (because you =A0
explicitly give an empty arg list)

Doh. I should have seen that. Thank you for helping my poor little
overtaxed brain ;)

Unfortunately now I get:

3) Error:
test_02_002(TC_Inheritor_02):
NoMethodError: super: no superclass method `koko' for
TC_Inheritor_02::C:Class
/mnt/repos/rubyworks/facets/lib/more/facets/inheritor.rb:70:in
`block (2 levels) in inheritor'
/mnt/repos/rubyworks/facets/test/more/test_inheritor.rb:31:in
`test_02_002'

Does defined?(super) not work in 1.9? If so, how does one work around?
 
I

Intransition

Doh. I should have seen that. Thank you for helping my poor little
overtaxed brain ;)

Unfortunately now I get:

=A0 3) Error:
test_02_002(TC_Inheritor_02):
NoMethodError: super: no superclass method `koko' for
TC_Inheritor_02::C:Class
=A0 =A0 /mnt/repos/rubyworks/facets/lib/more/facets/inheritor.rb:70:in
`block (2 levels) in inheritor'
=A0 =A0 /mnt/repos/rubyworks/facets/test/more/test_inheritor.rb:31:in
`test_02_002'

Does defined?(super) not work in 1.9? If so, how does one work around?

No, it works. I checked. So it's something else.

Thanks for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top