hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Eigenclass Considered... Considered! #

by why in cult

Matz is warming up to the term eigenclass, the People’s slang for (class << self; self; end). From [ruby-talk:231992]:

In my mindset, two candidates have survived. singleton_class (or singletonclass), which can easily be confused with a class in the singleton design pattern. And eigenclass, which is unfamiliar for most people.

Does anyone know if Perl 6 folks still use it?

said on 08 Jan 2007 at 10:21

While eigenclass is way cooler, singleton class makes more sense now that you have to do some funky, funky stuff to make a new instance based off of an existing object.

said on 08 Jan 2007 at 10:33

Perhaps it’s actually a good thing to use an unfamiliar term for what is probably, to most people learning Ruby, an unfamiliar concept. That way people won’t draw unwarranted conclusions about the concept from the word itself.

Besides, a simple explanation that “eigen” == “its own” should make the choice of terminology perfectly clear to people who grok the concept.

said on 08 Jan 2007 at 10:51

Danno, I really want the instantiating an eigenclass to get defunkified.

I like the term ‘shadow class’ but so far that seems unpopular. But it shadows the real class…

said on 08 Jan 2007 at 14:15

What is wrong with the term “metaclass”? That has been standard in OOP terminology since the 1980s.

said on 08 Jan 2007 at 15:44

Class is a meta class. It’s the class of classes. The word is already used for that.

said on 08 Jan 2007 at 15:44

Class is a meta class. It’s the class of classes. The word is already used for that.

said on 08 Jan 2007 at 15:44

Class is a meta class. It’s the class of classes. The word is already used for that.

said on 08 Jan 2007 at 15:53

Before, we only confused the OOP newbies. Now, we can also confuse the OOP experts.

said on 08 Jan 2007 at 19:05

Danno, actually, a while ago I found a much simpler way to do prototyped objects in Ruby:


# You have to do it this way. class Proto < Class will die.
Proto = Class.new(Class)
def Proto.clone; Class.new(self) end

a = Proto.clone
def a.ans
  42
end

puts a.ans

def b.foo
  super.to_s(2)
end

puts b.foo

Works well enough for me on 1.8.5 with no evil.rb in sight.

said on 08 Jan 2007 at 19:06

err….


b = a.clone

Should try to run things before not after.

said on 08 Jan 2007 at 19:08

hmm. last correction: foo should be ans.

said on 08 Jan 2007 at 20:14

I guess that’s what you get for writing code in public ;-)

said on 09 Jan 2007 at 11:48

I think using singleton is a mistake.

said on 11 Jan 2007 at 13:29

Damn, I guess this means my idea for using “Highlander” is out. Because, you know, there can be only one.

said on 24 Jan 2007 at 21:37

why is there a horse on your duck?

11 Jul 2010 at 20:49

* do fancy stuff in your comment.

PREVIEW PANE