[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Object#singleton_class in Ruby 1.9?

Yukihiro Matsumoto

1/30/2009 3:29:00 PM

Hi,

In message "Re: Object#singleton_class in Ruby 1.9?"
on Fri, 30 Jan 2009 20:15:17 +0900, "David A. Black" <dblack@rubypal.com> writes:

|> Was Object#singleton_class (or #eigen_class or #meta_class) planned for
|> Ruby 1.9 or 2.0?
|
|Not that I remember hearing about. I'd certainly like to see it.

We still don't have consensus on the name. eigenclass?
In that case, should we rename singleton_method to eigenmethod?

matz.

41 Answers

Gregory Brown

1/30/2009 3:48:00 PM

0

On Fri, Jan 30, 2009 at 10:28 AM, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Object#singleton_class in Ruby 1.9?"
> on Fri, 30 Jan 2009 20:15:17 +0900, "David A. Black" <dblack@rubypal.com> writes:
>
> |> Was Object#singleton_class (or #eigen_class or #meta_class) planned for
> |> Ruby 1.9 or 2.0?
> |
> |Not that I remember hearing about. I'd certainly like to see it.
>
> We still don't have consensus on the name. eigenclass?
> In that case, should we rename singleton_method to eigenmethod?

I wonder if this controversy has died down. There are people with
their favorites, sure, but does anyone really oppose singleton_class?

-greg


--
Technical Blaag at: http://blog.majesticseacr...
Non-tech stuff at: http://metametta.bl...
"Ruby Best Practices" Book now in O'Reilly Roughcuts:
http://rubybestpra...

James Gray

1/30/2009 3:53:00 PM

0

On Jan 30, 2009, at 9:47 AM, Gregory Brown wrote:

> On Fri, Jan 30, 2009 at 10:28 AM, Yukihiro Matsumoto <matz@ruby-lang.org
> > wrote:
>> Hi,
>>
>> In message "Re: Object#singleton_class in Ruby 1.9?"
>> on Fri, 30 Jan 2009 20:15:17 +0900, "David A. Black" <dblack@rubypal.com
>> > writes:
>>
>> |> Was Object#singleton_class (or #eigen_class or #meta_class)
>> planned for
>> |> Ruby 1.9 or 2.0?
>> |
>> |Not that I remember hearing about. I'd certainly like to see it.
>>
>> We still don't have consensus on the name. eigenclass?
>> In that case, should we rename singleton_method to eigenmethod?
>
> I wonder if this controversy has died down. There are people with
> their favorites, sure, but does anyone really oppose singleton_class?

I'm for singleton_class. It's what the official documentation has
used for a long time now. It's also not like it will be the only
overloaded term in computing.

James Edward Gray II

Gary Wright

1/30/2009 4:47:00 PM

0


On Jan 30, 2009, at 10:53 AM, James Gray wrote:
> I'm for singleton_class. It's what the official documentation has
> used for a long time now. It's also not like it will be the only
> overloaded term in computing.


eigenton_class? :-)

eigen_class or singleton_class doesn't really matter to
me at this point but I do feel strongly that the object
returned by:

(class <<obj; self; end)

should be available via a simple method call rather
than only via that expression.

Gary Wright




Trans

1/30/2009 5:43:00 PM

0

Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: Object#singleton_class in Ruby 1.9?"
> on Fri, 30 Jan 2009 20:15:17 +0900, "David A. Black"
> <dblack@rubypal.com> writes:
>
> |> Was Object#singleton_class (or #eigen_class or #meta_class) planned for
> |> Ruby 1.9 or 2.0?
> |
> |Not that I remember hearing about. I'd certainly like to see it.
>
> We still don't have consensus on the name. eigenclass?
> In that case, should we rename singleton_method to eigenmethod?

Since you make mention of "eigenclass", that would seem to be your bent.
And I say, go for it! "eigenmethod"? Fantastic! Do it, do it, do it!

It may be Germanic, but I for one like the shorter method names anyway.
And certainly _Why has done enough for Ruby to deserve a little of his
charm to shine through the language... it will just give Ruby another
unique touch that her fans can revel in. Not to mention, no more
Singleton vs. singleton controversy.

Big smiles and all thumbs up,

T.
--
Posted via http://www.ruby-....

David A. Black

1/30/2009 5:50:00 PM

0

Hi --

On Sat, 31 Jan 2009, Yukihiro Matsumoto wrote:

> Hi,
>
> In message "Re: Object#singleton_class in Ruby 1.9?"
> on Fri, 30 Jan 2009 20:15:17 +0900, "David A. Black" <dblack@rubypal.com> writes:
>
> |> Was Object#singleton_class (or #eigen_class or #meta_class) planned for
> |> Ruby 1.9 or 2.0?
> |
> |Not that I remember hearing about. I'd certainly like to see it.
>
> We still don't have consensus on the name. eigenclass?
> In that case, should we rename singleton_method to eigenmethod?

No, *please* don't. It would mean having to re-edit books as well as
code.... There's been enough change recently :-)


David

--
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.r...
Coming in 2009: The Well-Grounded Rubyist (http://manning....)

http://www.wis... => Independent, social wishlist management!

Suraj Kurapati

1/30/2009 5:51:00 PM

0

Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: Object#singleton_class in Ruby 1.9?"
> on Fri, 30 Jan 2009 20:15:17 +0900, "David A. Black"
> <dblack@rubypal.com> writes:
>
> |> Was Object#singleton_class (or #eigen_class or #meta_class) planned for
> |> Ruby 1.9 or 2.0?
> |
> |Not that I remember hearing about. I'd certainly like to see it.
>
> We still don't have consensus on the name. eigenclass?

Sorry, I only mentioned the other names because they were all proposed
when we first discussed this (back in 2006, I think). Ruby was the
first language where I learned the concept of "singleton class" (not the
design pattern) so I think it makes sense to keep that name.

> In that case, should we rename singleton_method to eigenmethod?

Is this not a larger (disruptive) change than simply adding a new
Object#singleton_class method?

Thanks for your consideration.
--
Posted via http://www.ruby-....

Suraj Kurapati

1/30/2009 5:57:00 PM

0

Thomas Sawyer wrote:
> Yukihiro Matsumoto wrote:
>> We still don't have consensus on the name. eigenclass?
>> In that case, should we rename singleton_method to eigenmethod?
>
> Since you make mention of "eigenclass", that would seem to be your bent.
> And I say, go for it! "eigenmethod"? Fantastic! Do it, do it, do it!

In that case, could we make the names more readable by adding an
underscore after "eigen"? I find it more difficult to parse the names
otherwise.

Object#eigen_class
Object#eigen_methods
Object#define_eigen_method

> Not to mention, no more Singleton vs. singleton controversy.

This is indeed a good benefit.

Thanks for your consideration.
--
Posted via http://www.ruby-....

Trans

1/30/2009 7:16:00 PM

0

Suraj Kurapati wrote:
> Thomas Sawyer wrote:
>> Yukihiro Matsumoto wrote:
>>> We still don't have consensus on the name. eigenclass?
>>> In that case, should we rename singleton_method to eigenmethod?
>>
>> Since you make mention of "eigenclass", that would seem to be your bent.
>> And I say, go for it! "eigenmethod"? Fantastic! Do it, do it, do it!
>
> In that case, could we make the names more readable by adding an
> underscore after "eigen"? I find it more difficult to parse the names
> otherwise.
>
> Object#eigen_class
> Object#eigen_methods
> Object#define_eigen_method

Interesting, I find the other more readable, 'class' is like a suffix to
me, along the lines of 'name' in methods like #basename and #dirname.

Just personal preference of course. I'm don't think there is any true
rational for one over the other.

T.
--
Posted via http://www.ruby-....

Trans

1/30/2009 7:18:00 PM

0

David A. Black wrote:
> Hi --
>
> On Sat, 31 Jan 2009, Yukihiro Matsumoto wrote:
>
>> We still don't have consensus on the name. eigenclass?
>> In that case, should we rename singleton_method to eigenmethod?
>
> No, *please* don't. It would mean having to re-edit books as well as
> code.... There's been enough change recently :-)

David! How else are you supposed to sell 2nd and 3rd editions! ;)

T.
--
Posted via http://www.ruby-....

Suraj Kurapati

1/30/2009 7:58:00 PM

0

Thomas Sawyer wrote:
> Suraj Kurapati wrote:
>> In that case, could we make the names more readable by adding an
>> underscore after "eigen"? I find it more difficult to parse the names
>> otherwise.
>>
>> Object#eigen_class
>> Object#eigen_methods
>> Object#define_eigen_method
>
> Interesting, I find the other more readable, 'class' is like a suffix to
> me, along the lines of 'name' in methods like #basename and #dirname.

The problem I have with words like "basename" is that, to me, they are
not actually words. For example, I pronounce "basename" as two separate
words "base, name" (with a brief pause in between) not as a continuous
word "basen-a-me" (without any pause in between).

The same applies to "dirname", which I pronounce as "dir, name". In
contrast, "singleton" is actually pronounced continuously as
"sin-gel-ton", not as "single, ton", so I have no need to insert
underscores in that word.

In short, how a word is pronounced tells me when to insert underscores.

> Just personal preference of course. I'm don't think there is any true
> rational for one over the other.

I beg to differ and I think there is a rationale (see above).

Thanks for your consideration.
--
Posted via http://www.ruby-....