Thanks - that explains both questions.

We've got this working pretty smoothly now.  If as Graydon pointed out we allow pragmas to be placed
anywhere in a block, the whole mechanism becomes much easier to use.  Rules about where you can and
can't put directives makes the language harder to predict and use.

Michael

Jeff Dyer wrote:

On 12/12/07 11:13 AM, Michael O'Brien wrote:

  
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.
    

That is correct. A namespace attribute in a package body overrides the
default package qualifier. AS3 allowed only public and internal at this
level, but we have agreed that we would allow such use of namespaces inside
of packages and interfaces. #335 just opened to clarify.

  
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?
    

The error probably has to do with the fact that the current grammar requires
packages to be defined at the top of a compilation unit. It is our intention
to change this letting package definitions to be interspersed with other
definitions and statements.

Jd
  
Michael O'Brien
_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss
    


  
_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to