Where is the define_singleton_method method?

  • Thread starter Eustáquio Rangel
  • Start date
E

Eustáquio Rangel

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 method `define_singleton_method'
for "":String (NoMethodError)
from dsm.rb:2:in `<main>'

Am I missing something?

Thanks!
 
N

Nobuyoshi Nakada

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.
 
E

Eustáquio Rangel

Nobuyoshi said:
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 Matsumoto <[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? :)

Thanks again!
 
N

Nobuyoshi Nakada

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 Matsumoto <[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.
 

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,773
Messages
2,569,594
Members
45,113
Latest member
Vinay KumarNevatia
Top