jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • JRuby
  • JRUBY-752

undef'ing and redef'ing methods should give disabled message?

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Not A Bug
  • Affects Version/s: JRuby 0.9.8
  • Fix Version/s: JRuby 1.x+
  • Component/s: Interpreter
  • Labels:
    None

Description

What a tangled mess....So first lets run this:

class Parent
  def lol() puts "P: LOL" end
end

class Child < Parent
  def lol() puts "C: LOL" end
end

c = Child.new
Child.class_eval { undef_method :lol }

class Child  #< Parent
  def lol
    print "LOL: "
    super
  rescue NameError => e
    puts e.to_s
 end
end

c.lol

This should print out:

LOL: superclass method `lol' disabled

If we look at this example it appears like the instance is created before redefinition. However that appears to be unrelated:

class Parent
  def lol() puts "P: LOL" end
end

class Child < Parent
  def lol() puts "C: LOL" end
end

Child.class_eval { undef_method :lol }

class Child  #< Parent
  def lol
    print "LOL: "
    super
  rescue NameError => e
    puts e.to_s
 end
end

c = Child.new
c.lol

Same result.
So it appears that ever undef'ing a method pretty much disables the ability to go to the super method. Why?
In any case we do not do this correctly, this test case is putting a dampening effect on my rubyclass elimination refactoring...

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Charles Oliver Nutter added a comment - 04/Apr/07 12:49 AM

I'd recommend asking ruby-core about this. It almost seems like a bug in Ruby that you can't undef a method and redefine it and expect super to work. I can't think of any good reason why it shouldn't be the intuitive way...

Show
Charles Oliver Nutter added a comment - 04/Apr/07 12:49 AM I'd recommend asking ruby-core about this. It almost seems like a bug in Ruby that you can't undef a method and redefine it and expect super to work. I can't think of any good reason why it shouldn't be the intuitive way...
Hide
Permalink
Charles Oliver Nutter added a comment - 30/Sep/07 10:33 AM

Close or fix for 1.1

Show
Charles Oliver Nutter added a comment - 30/Sep/07 10:33 AM Close or fix for 1.1
Hide
Permalink
Charles Oliver Nutter added a comment - 15/Feb/08 12:58 PM

Punting issues from 1.1 RC2 to 1.1 final.

Show
Charles Oliver Nutter added a comment - 15/Feb/08 12:58 PM Punting issues from 1.1 RC2 to 1.1 final.
Hide
Permalink
Thomas E Enebo added a comment - 27/Feb/08 6:41 PM

I would rather punt than close this until we get word about this from ruby-core.

Show
Thomas E Enebo added a comment - 27/Feb/08 6:41 PM I would rather punt than close this until we get word about this from ruby-core.
Hide
Permalink
Charles Oliver Nutter added a comment - 12/Feb/09 4:47 PM

This behavior appears to be a bug in Ruby 1.8.6 that has been fixed in 1.8.7 and 1.9.1. I've asked ruby-core for confirmation, but for the moment we'll mark this "Not A Bug".

Show
Charles Oliver Nutter added a comment - 12/Feb/09 4:47 PM This behavior appears to be a bug in Ruby 1.8.6 that has been fixed in 1.8.7 and 1.9.1. I've asked ruby-core for confirmation, but for the moment we'll mark this "Not A Bug".

People

  • Assignee:
    Charles Oliver Nutter
    Reporter:
    Thomas E Enebo
Vote (0)
Watch (1)

Dates

  • Created:
    01/Apr/07 1:46 PM
    Updated:
    09/Feb/11 12:26 PM
    Resolved:
    12/Feb/09 4:47 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.