Where is the define_singleton_method method?

I just got the svn trunk and was testing some new stuff, but could not
find the define_singleton_method:

irb(main):001:0> [RUBY_VERSION,RUBY_RELEASE_DATE]
=> [“1.9.0”, “2007-08-28”]
irb(main):002:0> a = “”
=> “”
irb(main):003:0> a.define_singleton_method(:foo){|x| x + 1}
NoMethodError: undefined method `define_singleton_method’ for “”:String

Running out of irc the same two lines above I get the same results:

[taq@~/code/ruby/1.9]ruby1.9 dsm.rb
dsm.rb:2:in method_missing': undefined methoddefine_singleton_method’
for “”:String (NoMethodError)
from dsm.rb:2:in `’

Am I missing something?

Thanks!

Hi,

At Wed, 29 Aug 2007 13:28:24 +0900,
=?utf-8?Q?Eust=c3=a1quio_Rangel?= wrote in [ruby-talk:266637]:

I just got the svn trunk and was testing some new stuff, but could not
find the define_singleton_method:

No such method is defined.

Nobuyoshi N. wrote:

No such method is defined.

Thanks for your answer, but now I’m kind of lost here. There’s a
reference of the method here:
http://www.ruby-doc.org/core-1.9/classes/Object.html#M000330

And here, where I got the previous samples:
http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9#l29

And also on the Changelog, from Matz!:
Mon Oct 9 01:56:34 2006 Yukihiro M. [email protected]

  • eval.c (rb_obj_define_method): add new method
    Kernel#define_singleton_method. [ruby-list:42851]

I got the latest trunk using:
svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby

I searched for rb_obj_define_method on the C code but could not find any
code for it. Searching for rb_define_singleton_method returns me a lot
of references of its internal use (as C code) and its definition on
class.c, but not as a method we can reach from the language, without a
thing like ‘rb_define_method(rb_mKernel, “define_singleton_method”,
rb_obj_instance_eval, -1);’ there.

So, I’m lost, what happened with this method? :slight_smile:

Thanks again!

Nobuyoshi N. wrote:

It seems lost at YARV merger. Reverted now.

Thank you!

Hi,

At Wed, 29 Aug 2007 19:26:39 +0900,
=?utf-8?Q?Eust=c3=a1quio_Rangel?= wrote in [ruby-talk:266659]:

And also on the Changelog, from Matz!:
Mon Oct 9 01:56:34 2006 Yukihiro M. [email protected]

  • eval.c (rb_obj_define_method): add new method
    Kernel#define_singleton_method. [ruby-list:42851]

It seems lost at YARV merger. Reverted now.