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

On 8/11/06, Trans [email protected] 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.


Rick DeNatale

http://talklikeaduck.denhaven2.com/

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.

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.

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

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

“T” == Tom W. [email protected] 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

“T” == Tom W. [email protected] 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 :slight_smile:

What is the next step, eigen method ?

Guy Decoux

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

“T” == Tom W. [email protected] 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

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

“T” == Tom W. [email protected] 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).

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), 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, Aug 12, 2006 at 03:44:40AM +0900, [email protected] 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.

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

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.

Rick DeNatale wrote:

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

A vector ‘x’ such that ‘Ax = lambdax’, where A is a square matrix.
‘lambda’ is the eigenvalue.

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

Hal F. [email protected] 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… :slight_smile:

foo.eigen_class
foo.singleton_class
foo.ueber_class

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.

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

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

M.T.