Defining Eigenclass

So, what is an eigenclass? I googled it, and couldn't find anything
about it (other than Mauricio's great blog/wiki). Wikipedia doesn't
have anything on it other than an indirect relation to Metaprogramming
(which I already know it's a part of, just not sure wherein).

Can someone provide some information on the idea of an eigenclass?

Thanks,

M.T.

Google Singleton class. That'll surely help :wink:

Matt Todd wrote:

So, what is an eigenclass? I googled it, and couldn't find anything
about it (other than Mauricio's great blog/wiki). Wikipedia doesn't
have anything on it other than an indirect relation to Metaprogramming
(which I already know it's a part of, just not sure wherein).

Can someone provide some information on the idea of an eigenclass?

I'll try. (I call it "singleton class" since that is what I learned.)

It's the "place" where things go that are associated with a specific
*object* rather than a *class* of objects.

For example, if I add a method to an object, that method "lives" in
the singleton class.

   superman = "Clark Kent"
   def superman.fly
     puts "Look! I'm flying!"
   end

Here the "fly" method is certainly not part of the String class. No
other string responds to that method -- only this one. It's a
singleton method, and it "lives" in the "singleton class."

You can see more clearly the class-like nature of this thing if
we use this syntax:

   class << superman
     def fly
       #...
     end
   end

That at least "looks" like a class. But also be aware:
1. It's not a "real" class in that it can't be instantiated.
2. Matz has said that this "thing" *may* not be considered a
    class in the future (IIRC).

Note that we can capture the actual value of the singleton class
if we want to:

   ssc = class << superman # ssc = superman's singleton class
     self # return self as last expression
   end

   puts ssc.class # Class

Finally, note that what we call "class methods" are just a special
case of singleton methods. Suppose Dog inherits from Mammal; then
suppose we make a Dog.bark class method.

Where does "bark" live? Clearly not "in" Dog (as an instance method
would be "in" it). Not in the parent class, either. It lives in the
singleton class of Dog.

So a "class method" is really just "a singleton method on an object
which happens to be a class."

Does that help any?

Hal

Yeah, that was very clear. Thanks for the explanation. I just didn't
connect Eigenclasses with Singleton classes.

But, actually, that's a good description of Singleton classes as well.

Thanks!

M.T.

The 'official' ruby docs talk about singleton classes, but eigenclass
seems to have been proposed by someone, somewhere, sometime as an
alternative.

This seems to be confined to the ruby community and provides the
subtext for things like eigenclass.org, but I can't seem to find where
the term came from originally.

I'd love enlightenment on that.

Now I guess that the etymology comes from the German word "eigen"
which can be translated to "own" or "individual", and also forms the
root of the mathematical terms "eigenvector" and "eigenvalue". If we
look at "eigenclass" from the perspective of "eigenvector" though, it
doesn't fit that well, since an "eigenvector" of a transformation in
linear algebra is a vector which is unchanged in direction (or more
properly only changes by being multiplied by a scalar) under that
transformation.

···

On 8/11/06, Trans <transfire@gmail.com> wrote:

Google Singleton class. That'll surely help :wink:

--
Rick DeNatale

http://talklikeaduck.denhaven2.com/

Rick DeNatale wrote:
>
> The 'official' ruby docs talk about singleton classes, but eigenclass
> seems to have been proposed by someone, somewhere, sometime as an
> alternative.
>

I recalled seeing the discussion in which eigenclass was first proposed. Here's the post by csaba on April 21, 2005:

<quote>
"Own class" is the best I've heard 'till now in terms of correctness,
it's just a bit "pale". I mean, when you say "I go there by my own
car", then the "own" doesn't refer to a special type of car, it just
refers to some relation of the car with other things. It refers to a
non-intrinsic thing. But if you say
"I go there by my batcar", that makes a difference. Such a thing is
what we need for ruby.
What about "eigenclass", like in eigenvalue?
</quote>

Which was part of the "Article: Seeing Metaclasses Clearly" thread started by _why on April 17, 2005.
See http://tinyurl.com/mjy3m.

I much prefer the name "eigenclass" to "singleton class" when referring to an object's own class. Avoids people having to always qualify what they mean by singleton class, as you will constantly see people say things like "when you have a Singleton class (one that include Singleton, not the eigenclass)", which is just annoying. The term singleton has already been taken by a design pattern. Besides, eigenclass is just a neat word. =)

Tom

···

--
Tom Werner
Helmets to Hardhats
Software Developer
tom@helmetstohardhats.org
www.helmetstohardhats.org

Rick DeNatale wrote:

···

On 8/11/06, Trans <transfire@gmail.com> wrote:

Google Singleton class. That'll surely help :wink:

The 'official' ruby docs talk about singleton classes, but eigenclass
seems to have been proposed by someone, somewhere, sometime as an
alternative.

This seems to be confined to the ruby community and provides the
subtext for things like eigenclass.org, but I can't seem to find where
the term came from originally.

I'd love enlightenment on that.

Now I guess that the etymology comes from the German word "eigen"
which can be translated to "own" or "individual", and also forms the
root of the mathematical terms "eigenvector" and "eigenvalue". If we
look at "eigenclass" from the perspective of "eigenvector" though, it
doesn't fit that well, since an "eigenvector" of a transformation in
linear algebra is a vector which is unchanged in direction (or more
properly only changes by being multiplied by a scalar) under that
transformation.

Hmpf ... I just realized that the typical definition of an eigenvector is

A vector 'x' such that 'A*x = lambda*x', where A is a square matrix. 'lambda' is the eigenvalue.

So, was eigenclass named after the eigenvalue or the eigenvector?

to an object's own class. Avoids people having to always qualify what
they mean by singleton class, as you will constantly see people say

Never look at the ruby source, or you'll have a surprise

moulon% grep ^rb_singleton_class ruby-1.8.5/*.c
ruby-1.8.5/class.c:rb_singleton_class_clone(obj)
ruby-1.8.5/class.c:rb_singleton_class_attached(klass, obj)
ruby-1.8.5/class.c:rb_singleton_class(obj)
moulon%

Guy Decoux

I think it was named for the "eigen" in both.

···

On Sat, Aug 12, 2006 at 01:42:26PM +0900, M. Edward (Ed) Borasky wrote:

So, was eigenclass named after the eigenvalue or the eigenvector?

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
unix virus: If you're using a unixlike OS, please forward
this to 20 others and erase your system partition.

ts wrote:

Never look at the ruby source, or you'll have a surprise

moulon% grep ^rb_singleton_class ruby-1.8.5/*.c
ruby-1.8.5/class.c:rb_singleton_class_clone(obj)
ruby-1.8.5/class.c:rb_singleton_class_attached(klass, obj)
ruby-1.8.5/class.c:rb_singleton_class(obj)
moulon%

Guy Decoux
  
Indeed the source code tells us what it calls the thing (singleton class), but should that forbid us from adopting a different, less ambiguous term when writing about and discussing the concept?

Tom

···

--
Tom Werner
Helmets to Hardhats
Software Developer
tom@helmetstohardhats.org
www.helmetstohardhats.org

Indeed the source code tells us what it calls the thing (singleton
class), but should that forbid us from adopting a different, less
ambiguous term when writing about and discussing the concept?

It's ambiguous only for you :slight_smile:

What is the next step, eigen method ?

Guy Decoux

ts wrote:

> Indeed the source code tells us what it calls the thing (singleton > class), but should that forbid us from adopting a different, less > ambiguous term when writing about and discussing the concept?

It's ambiguous only for you :slight_smile:

If that were true, we wouldn't be having this discussion. =)

Also, see the "nonce" thread going right now for others struggling with the less-than-stellarness of the currently used "singleton class".

Tom

···

--
Tom Werner
Helmets to Hardhats
Software Developer
tom@helmetstohardhats.org
www.helmetstohardhats.org

Also, see the "nonce" thread going right now for others struggling with
the less-than-stellarness of the currently used "singleton class".

This is the same thread, made by someone which has always had problems
with this term ...

Rien de nouveau sous le soleil ...

Guy Decoux

Funny . . . I've seen several people suggesting other names for it,
including David Black's "own class" recommendation (which predates
"eigenclass" as a suggestion).

···

On Sat, Aug 12, 2006 at 02:19:29AM +0900, ts wrote:

> Also, see the "nonce" thread going right now for others struggling with
> the less-than-stellarness of the currently used "singleton class".

This is the same thread, made by someone which has always had problems
with this term ...

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
This sig for rent: a Signify v1.14 production from http://www.debian.org/

Hi --

> Also, see the "nonce" thread going right now for others struggling with
> the less-than-stellarness of the currently used "singleton class".

This is the same thread, made by someone which has always had problems
with this term ...

Funny . . . I've seen several people suggesting other names for it,
including David Black's "own class" recommendation (which predates
"eigenclass" as a suggestion).

The history of it, as I recall it, is that Matz doesn't want to
implement RCR 231 (http://www.rcrchive.net/rcr/show/231\), unless and
until he comes up with what he considers the perfect name. Then
there's the "What does Matz have to do with it?", fait-accompli
campaign for eigenclass :slight_smile: And various other branchings off,
generalizations of "metaclass", and so on -- so that, unfortunately,
the singleton class is now most commonly known as something like:

   this thing that doesn't really have a name and is known sometimes as
   singleton class, but also as eigenclass, or metaclass, or
   something-else-class -- and it's really, really confusing and
   hard to understand....

David

···

On Sat, 12 Aug 2006, Chad Perrin wrote:

On Sat, Aug 12, 2006 at 02:19:29AM +0900, ts wrote:

--
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
   ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <-----
http://dablog.rubypal.com => D[avid ]A[. ]B[lack's][ Web]log
http://www.manning.com/black => book, Ruby for Rails
http://www.rubycentral.org => Ruby Central, Inc.

Works for me. Let's call it that.

···

On Sat, Aug 12, 2006 at 03:44:40AM +0900, dblack@wobblini.net wrote:

The history of it, as I recall it, is that Matz doesn't want to
implement RCR 231 (http://www.rcrchive.net/rcr/show/231\), unless and
until he comes up with what he considers the perfect name. Then
there's the "What does Matz have to do with it?", fait-accompli
campaign for eigenclass :slight_smile: And various other branchings off,
generalizations of "metaclass", and so on -- so that, unfortunately,
the singleton class is now most commonly known as something like:

  this thing that doesn't really have a name and is known sometimes as
  singleton class, but also as eigenclass, or metaclass, or
  something-else-class -- and it's really, really confusing and
  hard to understand....

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"It's just incredible that a trillion-synapse computer could actually
spend Saturday afternoon watching a football game." - Marvin Minsky

Chad Perrin wrote:

···

On Sat, Aug 12, 2006 at 03:44:40AM +0900, dblack@wobblini.net wrote:

The history of it, as I recall it, is that Matz doesn't want to
implement RCR 231 (http://www.rcrchive.net/rcr/show/231\), unless and
until he comes up with what he considers the perfect name. Then
there's the "What does Matz have to do with it?", fait-accompli
campaign for eigenclass :slight_smile: And various other branchings off,
generalizations of "metaclass", and so on -- so that, unfortunately,
the singleton class is now most commonly known as something like:

this thing that doesn't really have a name and is known sometimes as
singleton class, but also as eigenclass, or metaclass, or
something-else-class -- and it's really, really confusing and
hard to understand....

Works for me. Let's call it that.

Great! But put underscores in there for the RCR.

Hal

Oh, of course.

I'm inspired to make an industrial cover of the Depeche Mode song
"Personal Jesus". I'll call it Eigensavior.

···

On Sat, Aug 12, 2006 at 08:19:28AM +0900, Hal Fulton wrote:

Chad Perrin wrote:
>On Sat, Aug 12, 2006 at 03:44:40AM +0900, dblack@wobblini.net wrote:
>
>>The history of it, as I recall it, is that Matz doesn't want to
>>implement RCR 231 (http://www.rcrchive.net/rcr/show/231\), unless and
>>until he comes up with what he considers the perfect name. Then
>>there's the "What does Matz have to do with it?", fait-accompli
>>campaign for eigenclass :slight_smile: And various other branchings off,
>>generalizations of "metaclass", and so on -- so that, unfortunately,
>>the singleton class is now most commonly known as something like:
>>
>> this thing that doesn't really have a name and is known sometimes as
>> singleton class, but also as eigenclass, or metaclass, or
>> something-else-class -- and it's really, really confusing and
>> hard to understand....
>
>
>Works for me. Let's call it that.

Great! But put underscores in there for the RCR.

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
This sig for rent: a Signify v1.14 production from http://www.debian.org/

Hal Fulton <hal9000@hypermetrics.com> writes:

Chad Perrin wrote:

The history of it, as I recall it, is that Matz doesn't want to
implement RCR 231 (http://www.rcrchive.net/rcr/show/231\), unless and
until he comes up with what he considers the perfect name. Then
there's the "What does Matz have to do with it?", fait-accompli
campaign for eigenclass :slight_smile: And various other branchings off,
generalizations of "metaclass", and so on -- so that, unfortunately,
the singleton class is now most commonly known as something like:

this thing that doesn't really have a name and is known sometimes as
singleton class, but also as eigenclass, or metaclass, or
something-else-class -- and it's really, really confusing and
hard to understand....

Works for me. Let's call it that.

Great! But put underscores in there for the RCR.

We could add some magic that every method matching /_class/ returns
the singleton class... :slight_smile:

foo.eigen_class
foo.singleton_class
foo.ueber_class

···

On Sat, Aug 12, 2006 at 03:44:40AM +0900, dblack@wobblini.net wrote:

Hal

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

We could add some magic that every method matching /_class/ returns
the singleton class... :slight_smile:

foo.eigen_class
foo.singleton_class
foo.ueber_class

Hehe. That's fitting. Well, we could drop all pretenses

  foo._class

And call it the "under class".

T.