ECMAScript 5.1 Section 1, 2 and 3 – Scope, Conformance and Normative References

The first 3 sections of ECMAScript 5.1 are pretty short, but lay the foundation for the definition of the language.

Section 1: Scope

This section is super short — here is the whole thing:

“This Standard defines the ECMAScript scripting language.”

Okay, got it.

Section 2: Conformance

This section is just 4 paragraphs:

Conforming Implementations

First of all, “A conforming implementation of ECMAScript must provide and support all the types, values, objects, properties, functions, and program syntax and semantics described in this specification.”

A “conforming implementation” is just a JavaScript engine, like V8 from Google or SpiderMonkey from Mozilla or Chakra from Microsoft or JavaScriptCore from WebKit.  I will get to all of those things, but there a few more very important bits of information in section 2.

Encoding

Next, it says that a conforming implementation will interpret all characters (in a JavaScript source code text file) as UCS-2 or UTF-16 encoding, with UTF-16 as the default.  This means that your source code text file will be read as a UTF-16 encoded document, and although you may not choose to use funky Unicode characters as variable names, it is allowed!  More details on this later…

Extensibility

Next, it says that a conforming implementation can provide custom types, values, objects, properties and functions in addition to what is in the specification.  Custom properties and values for those properties are allowed on built-in objects.

Syntax

Finally, it allows for the addition of program and regular expression syntax not described in the spec, so an implementation can use the future reserved words that are provided in the specification even though their use has not been defined.

Section 3: Normative References

This is just a list of references (only 2 of them) that are “indispensable” for implementing the spec.  They are the C programming language specification and the Unicode specification:

  1. ISO/IEC 9899:1996, Programming Languages – C, including amendment 1 and technical corrigenda 1 and 2
  2. ISO/IEC 10646-1:1993, Information Technology – Universal Multiple-Octet Coded Character Set (UCS) plus its amendments and corrigenda

Summary

The first 3 sections of ECMAScript 5.1 lay the foundation for understanding how JavaScript really works.  It is especially important to understand that source code documents are assumed to be encoded as UTF-16 and that the spec allows for (but does not require) implementations to extend built-in objects and syntax.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 73 other followers

%d bloggers like this: