JAS is the language that the JASPA compiler converts to regular JavaScript; it is very similar to ActionScript 3.
The acronym JAS derives from JavaScript/ActionScript, but officially it means “JavaScript; Advanced Syntax”. This is partly due to potential trademark problems, and partly to make the distinction that it IS a separate language. The JASPA compiler contains absolutely no Adobe technology, or source code whatsoever.
The JAS syntax is designed to be as close to AS3 (ActionScript) as possible. When I say “as possible”, I mean that ideally I’d have made them identical, but for reasons too time-consuming to describe, certain things are in, certain things are out, and certain things behave a bit more like AS2. Ultimately JAS is an extension to the ECMAScript (ES3) standard, proving the kind of OOP enhancements that ActionScript programmers will find very familiar.
I shall digress and describe the similarities and differences between JAS and both ActionScript languages, feature-by-feature.
[ UPDATE: See http://jaspa.org.uk/wiki/JAS_language ]
Strong typing
The same fundamental type-declaration principals of AS2 & AS3 are in JAS. The AS3 as
operator is supported as well as AS2-style type-casting.
Untyped objects
The concept of an untyped object is supported, but AS3 wildcard syntax is not. i.e. var Obj:*;
is invalid in JAS. To declare an object untyped, just don’t declare any type at all. As per AS3, untyped objects are the only ones that may contain the special value undefined
.
Compile-time vs run-time
As per AS2, the JASPA compiler will not complete if there are type errors, or if illegal property access is attempted. However some runtime checks are also performed, particularly when AS2-style workarounds have been used to cheat the compiler.
Packages & Classes
AS3-style package and class declarations are supported, as are the folder/file naming conventions. Classes are imported with the import
keyword. Package-level members are not supported, but there is an internal
namespace. Unlike AS3, classes are not permitted outside a package declaration block. Private classes, (those available only within a class file), are defined inside the package block instead.
Code hiding
public
, private
, protected
, and internal
namespaces are supported, but custom namespaces are not. Unlike AS2, cheating these namespaces at compile-time will result in run-time errors. The AS3 keywords final
and override
are also enforced.
Interfaces & abstract members
These are not currently supported, but rest assured they will be.
Super calls
super
is fully supported. Use of super()
in class constructors is implemented as per AS3, which improves slightly on the AS2 implementation.
Getters & setters; property overloading
get
and set
function keywords are supported, and even enforced at runtime.
Native XML (E4X)
This is not implemented at all in the JAS syntax. There are no plans to support E4X.
Meta data
Not supported at all. There is no plans and probably no reason to support such a thing.
Closures
As per AS3, JAS supports implicit closures when passing, assigning or returning function objects. R.I.P Delegate.create!
Constants
The const
keyword is supported. At runtime constants are treated as read-only variables.
Rest arguments operator
The ...
(RestArgs) operator is supported in function arguments as per AS3.
Function parameter defaults
Default function parameters are supported;
e.g. function ( a:Number = 1 ){}
int & uint
After some experiments in implementing non-native integer classes, these have been omitted from JAS. They may be introduced in future, but as they will always be non-native there is little advantage of including them