From: Robert Klemme Date: 2005-08-17T17:41:15+09:00 Subject: Re: Prototype-based / Ruby question zimba.tm@gmail.com wrote: > I just stumbled across this page[1] on RubyGarden. The writer tells > that prototye-languages languages are great and that Ruby is not part > of them. > > As I understand the definition, prototype based languages don't > instanciate objects from a class, but rather clone an existing model > object. Ruby's classes are objects. But they are not cloned: >> class Foo;end => nil >> o=Foo.new => # >> Foo.class == o.class => false >> o.class == o.dup.class => true >> o.class == o.clone.class => true > So which is first, the Class or the Object ? In fact it's a circular dependency. The Ruby interpreter precreates certain objects, among them Object, Class and Module. From the perspective of a Ruby program it doesn't matter which of them was first - they are simply there as a connected graph of objects with a cycle. :-) > It makes me think of a french sentence which says : From the chicken > and the Egg, which was first ? (disregarding the theory of evolution) The cat. > [1] > http://rubygarden.org/ruby/ruby?action=browse&id=PrototypeBasedRuby Kind regards robert