According to the announcement,
With the old compiler, import behaved differently between type syntax and functional syntax. With the type syntax, the module name of referenced classes could be inferred by the list of imports; but in function code, it had to be explicitly stated:
With the new compiler, import works the same with types and functional syntax
import B; // Type syntax - no module function usageExample() as ClassInB { // Functional syntax - no more module return ClassInB(); }
But (assuming ClassInB is supposed to be the name of a class in module B), that fails to compile. I think the example should say "return new ClassInB();".
It's also not clear what names in B this applies to. ie, when I import module B, which things in module B become visible in the importing scope? And how does that interact with names that are already defined in the importing scope?
I tried:
module B { class ClassInB { } module ModuleInB { function test() as Number { return 1; } } function FunctionInB () as Number { return 2; } enum { EnumInB = 3, } const ConstantInB = 4; } import B; function test() { var x; x = new ClassInB(); // works x = ModuleInB.test(); // works x = FunctionInB(); // doesn't work x = EnumInB; // doesn't work x = ConstantInB; // doesn't work }
So classes and modules get imported, but not functions, or enums or constants?