Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Even ActionScript doesn't allow true circular dependencies.  In other words you can't do this:

public class A extends B

public class B extends A

 

But the Google Closure Compiler (GCC) is even more strict.  It will not allow:

...

This is allowed in Flash/AIR because both classes can be constructed by the runtime. The only type-checks for parent and child properties happens after initialization when code actually starts to run. In GCC, because Parent and Child are in different .js files, and it can't tell which one to load first, and there is no way to tell GCC that a dependency isn't needed at initialization time, GCC outputs an error.  That's because Child.js starts with:

goog.provide('Child');
goog.require('Parent');

and Parent.js starts with:

goog.provide('Parent');
goog.require('Child'); 

The output has to look like this because you don't know whether Child.js will be used first and need to bring in Parent or the other way around.

...