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

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

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

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

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

said on

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

said on

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

said on

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

said on

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

said on

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

err….


b = a.clone

Should try to run things before not after.

said on

hmm. last correction: foo should be ans.

said on

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

said on

I think using singleton is a mistake.

said on

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

said on

why is there a horse on your duck?

said on DD Mon YYYY at HH:MM

* do fancy stuff in your comment.

PREVIEW PANE