Namespaces

Michael O'Brien mob at mbedthis.com
Wed Dec 12 11:13:19 PST 2007


I've got a question about how user defined namespaces should resolve 
inside of packages.  This is really an ES4 implementation question and 
not a usage question.

Consider:

package one {
    public namespace blue = "http://blue"
}

package one {
    use namespace blue
    blue var x :int
}


package two {
    public namespace blue = "http://blue"
}

package two {
    use default namespace blue
    blue var x : string
}



This fails to compile as the two "blue var x" declarations have 
different fixture types. So this implies that variable declarations 
inside packages that have namespaces with identical URI => are not 
defined with any package qualification. ie. the namespace is the only 
qualification. This is what I expected, but just
wanted to confirm this.

Also, I noticed in the RI that you can't have namespace (and other) 
declarations outside of a "package {" block. ie.

namespace blue
package {
}


will fail to compile, but put the namespace declaration inside of 
"package {" and it works. Surely, these declarations should be allowed 
outside an explict package declaration due to the fact that there is an 
implicit "package {" around global declarations?

Michael O'Brien



More information about the Es4-discuss mailing list