# Defining Eigenclass

**URL:** <https://www.ruby-forum.com/t/defining-eigenclass/102358>\
**Category:** Ruby\
**Created:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358 "2006-08-15T14:16:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/1 "2006-08-15T14:16:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/2 "2006-08-15T14:16:02Z")

</div>

Google Singleton class. That’ll surely help 😉

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/3 "2006-08-15T14:16:06Z")

</div>

Matt T. 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

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/4 "2006-08-15T14:16:51Z")

</div>

On 8/11/06, Trans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Google Singleton class. That’ll surely help 😉

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](http://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.

–  
Rick DeNatale

[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/5 "2006-08-15T14:16:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/6 "2006-08-15T14:16:55Z")

</div>

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:

"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?

Which was part of the “Article: Seeing Metaclasses Clearly” thread  
started by \_why on April 17, 2005.  
See [http://tinyurl.com/mjy3m](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

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/7 "2006-08-15T14:16:59Z")

</div>

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?

Tom

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/8 "2006-08-15T14:16:55Z")

</div>

> > > > > “T” == Tom W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

T\> to an object’s own class. Avoids people having to always qualify what  
T\> 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

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/9 "2006-08-15T14:16:59Z")

</div>

> > > > > “T” == Tom W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

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

It’s ambiguous only for you 🙂

What is the next step, eigen method ?

Guy Decoux

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/10 "2006-08-15T14:17:00Z")

</div>

ts wrote:

> T\> Indeed the source code tells us what it calls the thing (singleton  
> T\> class), but should that forbid us from adopting a different, less  
> T\> ambiguous term when writing about and discussing the concept?
> 
> It’s ambiguous only for you 🙂

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

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/11 "2006-08-15T14:17:01Z")

</div>

> > > > > “T” == Tom W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

T\> Also, see the “nonce” thread going right now for others struggling  
with  
T\> 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

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/12 "2006-08-15T14:17:10Z")

</div>

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

> > > > > > “T” == Tom W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:
> 
> T\> Also, see the “nonce” thread going right now for others struggling with  
> T\> 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).

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/13 "2006-08-15T14:17:15Z")

</div>

Hi –

On Sat, 12 Aug 2006, Chad P. wrote:

> 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](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 🙂 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

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/14 "2006-08-15T14:17:15Z")

</div>

On Sat, Aug 12, 2006 at 03:44:40AM +0900, removed\_email\_address@domain.invalid wrote:

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

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/15 "2006-08-15T14:17:32Z")

</div>

Chad P. wrote:

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

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/16 "2006-08-15T14:17:33Z")

</div>

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

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

Oh, of course.

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

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:17pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/17 "2006-08-15T14:17:44Z")

</div>

Rick DeNatale wrote:

> 

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?

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:18pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/18 "2006-08-15T14:18:05Z")

</div>

Hal F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> > > 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… 🙂

foo.eigen\_class  
foo.singleton\_class  
foo.ueber\_class

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:18pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/19 "2006-08-15T14:18:15Z")

</div>

> We could add some magic that every method matching /\_class/ returns  
> the singleton class… 🙂
> 
> 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.

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [August 15, 2006, 2:18pm UTC](https://www.ruby-forum.com/t/defining-eigenclass/102358/20 "2006-08-15T14:18:41Z")

</div>

Ummmm… class object? Like, not the instance of the class, but the  
class object itself.

Would that be too transparent? 🙂 (Or, alternatively… just plain  
wrong… if I’m being slow.)

M.T.

[Next page](https://www.ruby-forum.com/t/defining-eigenclass/102358.md?page=2)
