Ruby.h missing rb_cMethod?

It seems to me ruby.h (1.8.4) is missing the exporting of rb_cMethod,
with a line similar to:

RUBY_EXTERN VALUE rb_cMethod;

Is this by design?

gga wrote:

It seems to me ruby.h (1.8.4) is missing the exporting of rb_cMethod,
with a line similar to:

RUBY_EXTERN VALUE rb_cMethod;

Is this by design?

Yes. Ruby has no first class methods therefore it doesn't exist a class Method.

regards,
Jan

Hi,

···

In message "Re: ruby.h missing rb_cMethod?" on Tue, 11 Jul 2006 19:55:05 +0900, Jan Friedrich <spamgrav@web.de> writes:

RUBY_EXTERN VALUE rb_cMethod;

Is this by design?

Yes. Ruby has no first class methods therefore it doesn't exist a class
Method.

Pardon me?

Ruby has first class methods, therefore it does have class Method.
It's just matter of implementation. I thought no one would require
access to the rb_cMethod. I will add it later.

              matz.

Yukihiro Matsumoto <matz@ruby-lang.org> writes:

Hi,

>> RUBY_EXTERN VALUE rb_cMethod;
>>
>> Is this by design?

>Yes. Ruby has no first class methods therefore it doesn't exist a class
>Method.

Pardon me?

Ruby has first class methods, therefore it does have class Method.
It's just matter of implementation. I thought no one would require
access to the rb_cMethod. I will add it later.

Ruby has first-class Method instances, but methods aren't first class, no?

irb(main):003:0> method(:nil?).object_id
=> 1758564
irb(main):004:0> method(:nil?).object_id
=> 1746454

···

In message "Re: ruby.h missing rb_cMethod?" > on Tue, 11 Jul 2006 19:55:05 +0900, Jan Friedrich <spamgrav@web.de> writes:

              matz.

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

Hi,

···

In message "Re: ruby.h missing rb_cMethod?" on Wed, 12 Jul 2006 05:37:54 +0900, Christian Neukirchen <chneukirchen@gmail.com> writes:

Ruby has first-class Method instances, but methods aren't first class, no?

irb(main):003:0> method(:nil?).object_id
=> 1758564
irb(main):004:0> method(:nil?).object_id
=> 1746454

Hmm. Does this behavior makes methods second-class?

              matz.

I think it is fair to say that Methods are first class, but ruby has no first class Method dictionaries. I would LOVE to have real method dicts like Smalltalk.

:method returns a copy of the method requested, but it is first class just the same. From c2.com:

"A language construct is said to be a FirstClass value in that language when there are no restrictions on how it can be created and used: when the construct can be treated as a value without restrictions."

I think methods in ruby fit that (for the most part).

···

On Jul 11, 2006, at 1:37 PM, Christian Neukirchen wrote:

Ruby has first-class Method instances, but methods aren't first class, no?

irb(main):003:0> method(:nil?).object_id
=> 1758564
irb(main):004:0> method(:nil?).object_id
=> 1746454

Hi --

···

On Wed, 12 Jul 2006, Yukihiro Matsumoto wrote:

Hi,

In message "Re: ruby.h missing rb_cMethod?" > on Wed, 12 Jul 2006 05:37:54 +0900, Christian Neukirchen <chneukirchen@gmail.com> writes:

>Ruby has first-class Method instances, but methods aren't first class, no?
>
>irb(main):003:0> method(:nil?).object_id
>=> 1758564
>irb(main):004:0> method(:nil?).object_id
>=> 1746454

Hmm. Does this behavior makes methods second-class?

1.5'th class, anyway :slight_smile:

David

--
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
Ruby for Rails => RUBY FOR RAILS, the Ruby book for
                                                     Rails developers
http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log
dblack@wobblini.net => me

Hi,

···

In message "Re: ruby.h missing rb_cMethod?" on Wed, 12 Jul 2006 09:00:46 +0900, dblack@wobblini.net writes:

>irb(main):003:0> method(:nil?).object_id
>=> 1758564
>irb(main):004:0> method(:nil?).object_id
>=> 1746454

Hmm. Does this behavior makes methods second-class?

1.5'th class, anyway :slight_smile:

Then strings are 1.5'th class too.

  2.times {
    p "foobar".object_id
  }

              matz.

Hi --

Hi,

>> >irb(main):003:0> method(:nil?).object_id
>> >=> 1758564
>> >irb(main):004:0> method(:nil?).object_id
>> >=> 1746454
>>
>> Hmm. Does this behavior makes methods second-class?
>
>1.5'th class, anyway :slight_smile:

Then strings are 1.5'th class too.

2.times {
   p "foobar".object_id
}

But "" is a literal constructor; you're instantiating String twice.
nil? is a method that already exists -- so it's more comparable to:

   s = "I already exist."
   2.times { p s.object_id }

Here's an imaginary illustration of what I think the difference is
between first-class and 1.5'th class:

With first-class methods, you'd be able to do something like:

   m = obj.method(:x)
   m.before_wrapper = Proc { ... }

And then:

   n = obj.method(:x)
   p n.before_wrapper.inspect # same Proc object

But if m and n are different objects, either this can't work, or it
would require some kind of invisible caching process.

David

···

On Wed, 12 Jul 2006, Yukihiro Matsumoto wrote:

In message "Re: ruby.h missing rb_cMethod?" > on Wed, 12 Jul 2006 09:00:46 +0900, dblack@wobblini.net writes:

--
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
Ruby for Rails => RUBY FOR RAILS, the Ruby book for
                                                     Rails developers
http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log
dblack@wobblini.net => me

dblack@wobblini.net wrote:

Hi --

Hi,

>> >irb(main):003:0> method(:nil?).object_id
>> >=> 1758564
>> >irb(main):004:0> method(:nil?).object_id
>> >=> 1746454
>>
>> Hmm. Does this behavior makes methods second-class?
>
>1.5'th class, anyway :slight_smile:

Then strings are 1.5'th class too.

2.times {
   p "foobar".object_id
}

But "" is a literal constructor; you're instantiating String twice.
nil? is a method that already exists -- so it's more comparable to:

  s = "I already exist."
  2.times { p s.object_id }

There's a difference between the object itself and how you got the object.

irb(main):001:0> String.name.object_id
=> 23076870
irb(main):002:0> String.name.object_id
=> 23073030

Strings are certainly first class. It's something about how you get the name of a class (or, analogously, a method instance) that makes it feel 1.5 class. Would you say that class names are not first-class objects?

···

On Wed, 12 Jul 2006, Yukihiro Matsumoto wrote:

In message "Re: ruby.h missing rb_cMethod?" >> on Wed, 12 Jul 2006 09:00:46 +0900, dblack@wobblini.net writes:

--
        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Hi --

Hi --

Hi,

>> >irb(main):003:0> method(:nil?).object_id
>> >=> 1758564
>> >irb(main):004:0> method(:nil?).object_id
>> >=> 1746454
>>
>> Hmm. Does this behavior makes methods second-class?
>
>1.5'th class, anyway :slight_smile:

Then strings are 1.5'th class too.

2.times {
   p "foobar".object_id
}

But "" is a literal constructor; you're instantiating String twice.
nil? is a method that already exists -- so it's more comparable to:

  s = "I already exist."
  2.times { p s.object_id }

There's a difference between the object itself and how you got the object.

irb(main):001:0> String.name.object_id
=> 23076870
irb(main):002:0> String.name.object_id
=> 23073030

Strings are certainly first class. It's something about how you get the name of a class (or, analogously, a method instance) that makes it feel 1.5 class.

Would you say that class names are not first-class objects?

It's tricky -- the names per se are not really objects, i.e., there's
no "name of class String" object in object-space. The most you can
say is that the name method returns a string, which is a first-class
object. So is the next string it returns, and the next.... But the
class's name itself is not an object, any more than "'abcdef'
backwards" is an object before you do: 'abcdef'.reverse.

David

···

On Thu, 13 Jul 2006, Joel VanderWerf wrote:

dblack@wobblini.net wrote:

On Wed, 12 Jul 2006, Yukihiro Matsumoto wrote:

In message "Re: ruby.h missing rb_cMethod?" >>> on Wed, 12 Jul 2006 09:00:46 +0900, dblack@wobblini.net writes:

--
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
Ruby for Rails => RUBY FOR RAILS, the Ruby book for
                                                     Rails developers
http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log
dblack@wobblini.net => me

dblack@wobblini.net wrote:

It's tricky -- the names per se are not really objects, i.e., there's
no "name of class String" object in object-space. The most you can
say is that the name method returns a string, which is a first-class
object. So is the next string it returns, and the next.... But the
class's name itself is not an object, any more than "'abcdef'
backwards" is an object before you do: 'abcdef'.reverse.

Doesn't the same statement apply to methods? Instances of class Method are first class objects, but "the method that object x uses to respond to message 'foo'" can't really be said to be first class or not.

···

--
        vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407