Actionscript 3 Language Specification
Total Page:16
File Type:pdf, Size:1020Kb
Actionscript 3 Language Specification Editor: Jeff Dyer Co-editors: Edwin Smith Gary Grossman Francis Cheng Revision History: November 14, 2005 Intial proposal submited to Ecma TC39/TG1 Purpose and status of this document This document defines the Actionscript 3 (AS3) language that is designed to be forward compatible with the next edition of ECMA-262. It serves as Macromedia’s initial proposal for the definition of Ecma-262 edition 4. Actionscript 3 Language Specification 1 of 139 Macromedia, Inc. Contents 1 Tutorial introduction .............................................................................................................................................. 7 1.1 Hello world ....................................................................................................................................................... 7 1.2 Expressions ....................................................................................................................................................... 7 1.3 Statements ......................................................................................................................................................... 7 1.4 Variables ............................................................................................................................................................ 7 1.5 Functions ........................................................................................................................................................... 8 1.6 Classes ................................................................................................................................................................ 8 1.7 Interfaces ........................................................................................................................................................... 8 1.8 Packages ............................................................................................................................................................ 9 1.9 Namespaces ...................................................................................................................................................... 9 2 Design perspective ............................................................................................................................................... 11 2.1 Compatibility with existing programs ........................................................................................................ 11 2.2 Compatibility with existing object models ................................................................................................. 11 2.3 Controlling the visibility of names .............................................................................................................. 11 2.4 Choosing between reliability and flexibility .............................................................................................. 11 3 Phases and dialects of interpretation ................................................................................................................. 13 3.1 Parsing ............................................................................................................................................................. 13 3.2 Verifying .......................................................................................................................................................... 13 3.2.1 Compile time constant expressions ...................................................................................................... 13 3.3 Evaluating ....................................................................................................................................................... 13 3.4 Strict verification ............................................................................................................................................ 13 3.4.1 Type errors ................................................................................................................................................ 14 3.4.2 Strict errors ............................................................................................................................................... 14 4 Fundamental Concepts ........................................................................................................................................ 15 4.1 Notation ........................................................................................................................................................... 15 4.2 Data .................................................................................................................................................................. 15 4.2.1 Objects ....................................................................................................................................................... 15 4.2.2 Names ........................................................................................................................................................ 15 4.2.3 Prototypes and delegates ........................................................................................................................ 15 4.2.4 Properties .................................................................................................................................................. 15 4.2.5 Slots ............................................................................................................................................................ 15 4.2.6 Traits .......................................................................................................................................................... 16 4.2.7 Methods .................................................................................................................................................... 17 4.2.8 Lexical environment ................................................................................................................................ 17 4.2.9 References ................................................................................................................................................. 17 4.2.10 Native classes ........................................................................................................................................... 18 4.3 Procedures ....................................................................................................................................................... 19 4.3.1 Reading ..................................................................................................................................................... 19 4.3.2 Writing ...................................................................................................................................................... 20 4.3.3 Calling ....................................................................................................................................................... 20 4.3.4 Constructing ............................................................................................................................................. 21 4.3.5 Deleting ..................................................................................................................................................... 22 4.3.6 Naming ...................................................................................................................................................... 22 4.3.7 Typing ....................................................................................................................................................... 23 4.3.8 Converting ................................................................................................................................................ 23 4.3.9 Checking ................................................................................................................................................... 24 4.3.10 Operating .................................................................................................................................................. 24 5 Names .................................................................................................................................................................... 28 5.1 Definition names ............................................................................................................................................ 28 5.2 Reference names ............................................................................................................................................. 28 5.3 Name lookup .................................................................................................................................................. 29 5.3.1 Object references ...................................................................................................................................... 29 5.3.2 Lexical references ..................................................................................................................................... 30 6 Types ...................................................................................................................................................................... 32 6.1 Run time versus compile time type ............................................................................................................