Strategies for resolving cyclic dependencies in static ctors

spir denis.spir at gmail.com
Wed Mar 23 04:26:08 PDT 2011


On 03/23/2011 12:12 AM, Graham St Jack wrote:
> Avoiding circularities has plenty of advantages, like progressive development,
> testing and integration.

Maybe it depends on your app domain or whatnot; there are lots of cases, I 
guess, where circularities are inevitable, if not direct expression of the problem.
Take for instance a set of factories (eg parsing pattern) defined in a M1 
producing reesults (eg parse tree nodes) defined in M2. It's clear that M1 
imports M2. Then, how do you unittest M2? You should import M1... Sure, there 
are various workarounds (creating fake pattern types or objects, exporting the 
tests in a 3rd module...), but they are only this: workarounds.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list