"Robert Klemme" <bob.news / gmx.net> wrote in message news:2i0ktaFhdqcfU1 / uni-berlin.de...
|
| Apparently the inclusion sequence differs if you have two separate include
| statements vs. one statement with two modules.
|

Yes, I thought so (and tested all variants indeed), but OP had posted
the same code I tryed, and had different output. Probably the behavior
of this construction is not defined by the language. Or he just didn't try
his own code.
---
Georgy

| > "Bill Atkins" <dejaspam / batkins.com> wrote in message
| news:e6056acc.0405251343.550af715 / posting.google.com...
| > | Can anyone explain how Ruby's mixin system is better than regular
| > | multiple inheritance?  What's the difference between:
| > |
| > | ----
| > |
| > | module Parent1
| > |     def amb_func
| > |         puts "in parent1"
| > |     end
| > | end
| > |
| > | module Parent2
| > |     def amb_func
| > |         puts "in parent2"
| > |     end
| > | end
| > |
| > | class Child
| > |     include Parent1, Parent2
| > | end
| > |
| > | Child.new.amb_func
| > |
| > | ----
| > |
| > | and
| > |
| > | ----
| > |
| > | class Parent1
| > |     def amb_func
| > |         puts "in parent1"
| > |     end
| > | end
| > |
| > | class Parent2
| > |     def amb_func
| > |         puts "in parent2"
| > |     end
| > | end
| > |
| > | class Child < Parent1, Parent2
| > | end
| > |
| > | Child.new.amb_func
| > |
| > | ---
| > |
| > | Aside from the fact that the second example obviously isn't valid
| > | Ruby, how is the first scenario an improvement over the second?  The
| > | first outputs "in parent2" and I assume the second would as well.  Can
| > | somebody please explain this?
| > |
| > | Bill
| >
| >
|