View comments | RSS feed

5 Names

A name consists of a string and a namespace. Names are introduced into a particular scope by a definition. Those definitions are referred to by names that result from expressions.

The qualified forms result in a single name consisting of the given qualifier and identifier. The unqualified forms result in a set of names consisting of strings qualified by the open namespaces.

The visibility of an identifier is controlled by the set of open namespaces. The set of open namespaces includes all of the implicitly opened namespaces and the namespaces opened by the user. The implicitly opened namespaces are as follows:

The namespaces opened by the user are controlled by the use namespace directives that are in scope. For example:

namespace mx = "http://macromedia.com/mx"
use namespace(mx)
o.m()

In this example, the reference to o.m() will involve the names qualified by the namespace mx as well as the implicitly opened namespaces: public, internal, etc.

The terms namespace and qualifier are used interchangeably when talking about qualified names.


Comments


Constantiner said on Mar 2, 2006 at 12:04 PM :
use namespace(mx)

This example conflicts with http://livedocs.macromedia.com/specs/actionscript/3/as3_specification11.html#wp160165 :
use namespace English
I'm about brackets around namespace.

And what about careless way of code examples (for example semicolns at the end of statements)?
Francis Cheng said on Mar 6, 2006 at 3:05 PM :
The "use namespace" statement accepts a list of one or more namespaces, so you can use parentheses or omit them. It's up to you. As for the lack of semicolons, ECMAScript has something called "Automatic Semicolon Insertion" (Section 7.9 of ECMA-262 3rd ed.). Semicolons are optional in many, but not all, circumstances. Omitting semicolons is a matter of personal style, and is not necessarily considered a best practice. The engineer who wrote these examples prefers not to use semicolons. Please keep in mind that this is a beta document. Your input is important, and I will definitely consider adding semicolons to all code examples if the lack of them interferes with your comprehension of the code samples.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/specs/actionscript/3/as3_specification44.html