On 5/4/06, James Edward Gray II <james / grayproductions.net> wrote:> On May 3, 2006, at 4:58 PM, David Pollak wrote:> > In Java (unless the developers have used AOP), I know that no> > matter the> > order that my classes are loaded, the code will execute the same way.> >> > In Ruby this is not the case. Because classes patch other classes,> > the> > order in which the patches happen impact the code path.>> I have no idea what you are saying here. It honestly sounds like you> are making things up now. I'm pretty confident the order Ruby loads> code is a well defined process. Please show us some sample code. How about this (long) example: >cat a.rbclass A; def a; "a"; end end >cat a2.rbclass A; def a; 10; end end >cat aizer.rbrequire 'a'require 'a2' class B; def b A.new.a + 25 endend >cat kaiser.rbrequire 'a2'class A; def b; a + 10; end end >cat this_works.rbrequire 'aizer'require 'kaiser' puts((A.new.b rescue 'A#b failed'))puts((B.new.b rescue 'B#b failed')) >cat this_breaks.rbrequire 'kaiser'require 'aizer' puts((A.new.b rescue 'A#b failed'))puts((B.new.b rescue 'B#b failed')) How can this be avoided? Ilmari