From: Douglas Seifert Date: 2009-04-05T23:45:35+09:00 Subject: Re: Loading classes in order --000e0cd30aa4c36ba20466cfd71c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable circular dependency comes to mind ... On Sat, Apr 4, 2009 at 12:04 PM, I=F1aki Baz Castillo wrote= : > El S=E1bado 04 Abril 2009, Tony Arcieri escribi=F3: > > Merb's loader works somewhat similarly to what Inaki pasted, except it > > loops, retrying the failed files. If it loops through the failed files > and > > no new ones are loaded it gives up. > > Imagining a very complex case it could occur that class_A defined in file= _A > depends on class_C defined in file_C, and class_C depends on class_B > defined > in file_B. > > So the correct loading order would be: > > require "file_B" > require "file_C" > require "file_A" > > Loading in alphabetic order (A, B, C) would load just file_B. So file_A a= nd > file_C would require a new try. Trying again in alphabetic order (A, C) > would > load just file_C, and file_A would fail. > So a third attemp would load just file_A (succesfully now). > > I wonder if could be a case in which this approach wouldn't work. > > > -- > I=F1aki Baz Castillo > > --000e0cd30aa4c36ba20466cfd71c--