From: Joel VanderWerf Date: 2005-07-28T06:13:52+09:00 Subject: Re: What's so special about operators, built-in classes and modules? Pit Capitain wrote: > twifkak@comcast.net schrieb: > >>> Then you will have complex network of classes instead of simple >>> tree structure, sharing code with modules. >> >> >> How does a complex network of classes differ from a complex network >> of mixins? The main difference that I see is, as Ara pointed out, >> #is_a?. But I could be missing something. I usually am. > > > For me, the main difference between modules and classes is that classes > "define" state (instance variables), not only behaviour (methods). One > classic problem with multiple inheritence is the so called diamond: Actually, wouldn't it make more sense to say that neither classes nor modules define state, but rather that methods do? classirb(main):001:0> class A; attr_accessor :x; end => nil irb(main):002:0> a = A.new => # irb(main):003:0> a.x = 6 => 6 irb(main):004:0> a => # ^^^^ irb(main):005:0> module M; attr_accessor :y; end => nil irb(main):006:0> class A; include M; end => A irb(main):007:0> a => # irb(main):008:0> a.y = 8 => 8 irb(main):009:0> a => # ^^^^