-
Notifications
You must be signed in to change notification settings - Fork 19
Speedy.js Language Reference
Speedy.js is a subset of TypeScript, and therefore, only valid TypeScript files (consolidate the TypeScript Language Specification) are valid in Speedy.js. This page describes the TypeScript features supported by Speedy.js. Features not listed on this page are unsupported.
Speedy.js only supports let
and const
declarations. var
declarations are not supported.
The following primitive types are supported:
- number
- int
- boolean
The only objects supported are Classes and Arrays. Object literals are (not yet) supported.
Classes are supported including constructors and fields. Class inheritance is not (yet) supported.
The language supports arrays containing elements of a single type (base or object type). Arrays support the following methods, properties, and accessors.
-
[x1, x2, x3]
: Array Literals new Array<T>()
new Array<T>(int)
new Array<T>(x1, x2, x3)
-
[index: int]
Only integer indexes are supported. The semantics differ from JavaScript in that the default value is returned if the array index is out of bound instead of returning undefined. -
[index: int] = value
: Only integer indexes are supported. The semantics differs from JavaScript as it throws if the index is out of bound instead of automatic resizing the array. .length
.fill
.push
.unshift
-
.pop
: The semantics differ from JavaScript in that the default value for the array element type is returned instead of undefined if the array is empty. -
.shift
: The semantics differ from JavaScript in that the default value for the array element type is returned instead of undefined if the array is empty. .slice
.splice
Is not and never will be supported.
The this
keyword is supported inside class methods.
π
-
true
,false
- number literals (0.0, 2.3, 9.3)
- int literals (0, 2, 9)
- Array literals
undefined
π
Only accessing existing properties is allowed.
- Dot Notation: Supported if the property exists
- Bracket Expression: Unsupported
Only if the expression is a class.
Supported except if the expression is not a class (needs to be called with new
).
!
-
--
++
+
~
The delete
, void
and typeof
operator are not yet supported.
-
&
,&=
&&
-
*
,*=
-
**
,**=
-
|
,|=
||
-
^
,^=
-
===
,!==
-
>
,=>
-
>>
,>>=
-
>>>
,>>>=
-
<
,<=
-
<<
,<<=
-
-
,-=
%
-
+
,+=
-
/
,/=
=
The comparison operators for number
differ from the JavaScript specification as values are compared unordered. Therefore, the result of a comparison of NaN
to any other value is undefined.
Unsupported are:
-
==
Loos equality in
instanceof
π
π
π
π
Simple let
and const
variable declarations are supported (without destructuring)
π
π
π
π
Only for Arrays
π
Functions need to be declared at the root level of the file. Only Function Expressions or Arrow Functions are not yet supported.
- Optional arguments
- Default values
- Vararg arguments
Not supported are:
- Closures
- Function Overloads
- Generic Functions
- Vararg arguments for entry functions
The following objects and operations from the runtime environment are supported.
cos
log
pow
sin
sqrt
π