Hi!

In my recent project, I need, that a class knows about their instances.

So after
class MyClass
...
end
a,b=MyClass.new,Myclass.new

I except MyClass.instances to give me an array [a,b]
Or I would be happy, if I can do
MyClass.each{|a| ... }

I can do it in one class, BUT, I need it as a module, because I cannot
subclass my class from that class?

BTW Is the latter solution "cheaper" (memory, execution time...)

And, another question, which is more general:
Has ruby a set type?
Implementing them with an array is not appropiate, because lookup is
slow in an array. And, I'm confused about the set methods in the array
classes. When I need sets, I always use hashes with dummy values, but I
think a separate class would be nice.

-- 
+-[ Kontra, Gergely<kgergely / mcl.hu> PhD student Room IB113 ]---------+
| http://www.mcl.hu/~kgergely            "Olyan langesz vagyok, hogy  |
| Mobil:(+36 20) 356 9656 ICQ: 175564914   poroltoval kellene jarnom" |
+---Magyar php mirror es magyar php dokumentacio: http://hu.php.net---+