On 9/18/15, 9:02 AM, "Josh Tynjala" <joshtynj...@gmail.com> wrote:
>I don't think that there's a currently a way to explicitly specify the >global namespace in a fully-qualified class name. I suspect it rarely came >up in the Flash runtime because it has so few global classes. This would >be >very useful with the very large number of classes in the JavaScript global >namespace, though. I hope you can figure out how to add it! I don’t know if there is currently a way or not. I’m currently stepping through the lexer/parser to see how it handles namespaces. The concept of namespaces is heavily used within the compiler. There appear to be special namespaces like “public”, “protected” and “private” and user defined namespaces (like mx_internal) and packages are also namespaces and not objects like they are in JS. If there isn’t a current way, my first thoughts are to designate a special token or keyword for a user-defined namespace that implies the global namespace or trick the package namespace lexer/tokenizer to allow something. For example, user-defined namespaces are indicated in-line with ‘::’ as in: mx_internal::someVar And package namespaces are indicated with a dot-path expression to fully qualify something as in: org.apache.flex.events.Event So maybe one of the following can currently be used or the compiler can be taught to use as a way to fully qualify the “global” package/namespace. ::Event // nothing in front of the user-defined namespace delimiter null::Event global::Event *::Event *.Event null.Event .Event // nothing in front of the package path delimiter FWIW, there appear to be “hidden” namespaces for the builtins like Object, Array, String. I see use of: http://adobe.com/AS3/2006/builtin and AS3 as namespaces in the compiler code. We could use AS3 as the special keyword so AS3::Event is the Event in the global namespace, but that doesn’t feel right to me. I’m leaning towards keeping these namespaces for the true builtins for AS and JS. But I’m open to change on that. Thoughts? -Alex