On Sat, 20 Dec 2008 18:45:24 +0100, Lars Ivar Igesund wrote: > bearophile wrote: > >> Walter Bright: >>> Excess isn't the problem, I want to see if import cycles is. >> >> Generally all the modules in my dlibs import each other. This is nearly >> unavoidable, if a module contains string functions, and another one >> contains math stuff, the string module will want to use some math stuff >> and the math module may need string representations and processing. In the >> D specs I haven't seen an advice to not use cyclic imports, so I don't >> want such compiler flag, I prefer a compiler able to manage such cyclic >> imports efficiently. > > Cyclic imports is very often a sign of bad design, it typically mean > (if it is unavoidable), that the modules shouldn't be separated in the > first place. And in D it _is_ a bad idea because static initialization > cannot depend on each other, that is cyclic imports of modules with > static ctors.
Just thinking out aloud ... If two modules import each other and this can be 'fixed' by instead having both modules as a single module, what is stopping the compiler from just pretending that they are a single module for compilation purposes? This does assume that they are to be compiled at the same time rather than one-file-at-a-time. -- Derek Parnell Melbourne, Australia skype: derek.j.parnell
