views:

410

answers:

2

I have two Flex libraries that reference each other. Both use link type "External", and I manually load then with the Loader class.

I'm getting the error "A cycle was detected in the build path of project: foo".

Is there any way to resolve this? Maybe a parameter for the compiler or something.

I don't think there should be a problem, since with the external link type the source code doesn't get compiled into the library...

A: 

Not sure if this is the same issue, but it may help: http://www.adobe.com/devnet/flex/articles/link%5Fload%5F07.html

maclema
A: 

It sounds more like you need to rethink your code.

Maybe you can eleminate dependency one way by using interfaces?

If you could give an overview of the dependencies maybe I or someone else could give ideas on how to redesign the structure.

Edit:

How nice of you to give me a minus... Let me quote the Wikipedia article on the subject:

[...] in software design circular dependencies between larger software modules are considered an anti-pattern because of their negative effects.

[...]

Circular dependencies can cause many unwanted effects in software programs. Most problematic from a software design point of view is the tight coupling of the mutually dependent modules which reduces or makes impossible the separate re-use of a single module.

Circular dependencies can cause a domino effect when a small local change in one module spreads into other modules and has unwanted global effects (program errors, compile errors). Circular dependencies can also result in infinite recursions or other unexpected failures.

Circular dependencies may also cause memory leaks by preventing certain very primitive automatic garbage collectors (those that use reference counting) from deallocating unused objects.

[...]

Circular dependencies are often introduced by inexperienced programmers who need to implement some kind of callback functionality. Experienced programmers avoid such unnecessary circular dependencies by applying design patterns like the observer pattern.

(Emphasis added)

But then again, maybe you are smarter than the collective that writes on wikipedia...

Lillemanden