Namespaces

May 3, 2011 at 11:32 PM

Hi fickerra,

The following namespace code does not compile because the namespaces are converted to lowercase but the namespace reference in the var decl isnt.

namespace TestN {
    class TestNamespace1 {
        public int Get() { return 1; }
    }
}
namespace Test {
    class TestNamespace {
        public static void Test() {
            var a = new TestN.TestNamespace1();
        }
    }

The above produces the following haxe which does not compile:

var a:TestN.TestNamespace1 = new TestN.TestNamespace1();

Converting the namespaces to lowercase compiles:

var a:testn.TestNamespace1 = new testn.TestNamespace1();

The workaround is to provide a using statement:

using RPGATestN;
namespace Test {
    class TestNamespace2 {
        public static void Test() {
            var a = new TestNamespace1();
        }
    }
}

This compile fine:
import rpgatestn.TestNamespace1;
class TestNamespace2 {
    public static function Test():Void {
        var a:TestNamespace1 = new TestNamespace1();