Would need to include the types listed above. Probably in a more verbose view than a list.
boolean
is an alias for Boolean
when boolean
is imported.
string
is an alias for String
when string
is imported.
symbol
is an alias for Symbol
when symbol
is imported.
number
is an alias for Number
when number
is imported.
object
is an alias for Object
when object
is imported.
int8
, int16
, int32
, int64
int8.parse(string, radix = 10)
uint8
, uint16
, uint32
, uint64
uint8.parse(string, radix = 10)
bigint
bigint.parse(string, radix = 10)
float16
, float32
, float64
, float80
, float128
TODO: Requirements in the spec? Is referring to the specs for each sufficient?
https://en.wikipedia.org/wiki/Half-precision_floating-point_format
https://en.wikipedia.org/wiki/Single-precision_floating-point_format
https://en.wikipedia.org/wiki/Double-precision_floating-point_format
https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format
decimal32
, decimal64
, decimal128
https://en.wikipedia.org/wiki/Decimal32_floating-point_format
https://en.wikipedia.org/wiki/Decimal64_floating-point_format
https://en.wikipedia.org/wiki/Decimal128_floating-point_format
boolean8x16
, boolean16x8
, boolean32x4
, boolean64x2
, boolean8x32
, boolean16x16
, boolean32x8
, boolean64x4
int8x16
, int16x8
, int32x4
, int64x2
, int8x32
, int16x16
, int32x8
, int64x4
uint8x16
, uint16x8
, uint32x4
, uint64x2
, uint8x32
, uint16x16
, uint32x8
, uint64x4
float32x4
, float64x2
, float32x8
, float64x4
rational
https://en.wikipedia.org/wiki/Rational_data_type
complex
https://en.wikipedia.org/wiki/Complex_data_type
any
void
Used solely in function signatures to denote that a return value does not exist.
TODO:...
The internal comparison abstract operation SameValueNonNumber(x, y), where neither x nor y are Number values, produces true or false. Such a comparison is performed as follows:
Assert: Type(x) is not Number.
Assert: Type(x) is the same as Type(y).
If Type(x) is Undefined, return true.
If Type(x) is Null, return true.
If Type(x) is String, then
If x and y are exactly the same sequence of code units (same length and same code units at corresponding indices), return true; otherwise, return false.
If Type(x) is Boolean, then
If x and y are both true or both false, return true; otherwise, return false.
If Type(x) is Symbol, then
If x and y are both the same Symbol value, return true; otherwise, return false.
If x and y are the same Object value, return true. Otherwise, return false.
The comparison x == y, where x and y are values, produces true or false. Such a comparison is performed as follows:
- If Type(x) is the same as Type(y), then a. Return the result of performing Strict Equality Comparison x === y.
- If Type(x) has an implicit cast to Type(y), then a.
- If x is null and y is undefined, return true.
- If x is undefined and y is null, return true.
- If Type(x) is Number and Type(y) is String, return the result of the comparison x == ! ToNumber(y).
- If Type(x) is String and Type(y) is Number, return the result of the comparison ! ToNumber(x) == y.
- If Type(x) is Boolean, return the result of the comparison ! ToNumber(x) == y.
- If Type(y) is Boolean, return the result of the comparison x == ! ToNumber(y).
- If Type(x) is either String, Number, or Symbol and Type(y) is Object, return the result of the comparison x == ToPrimitive(y).
- If Type(x) is Object and Type(y) is either String, Number, or Symbol, return the result of the comparison ToPrimitive(x) == y.
- Return false.
Move enum from 11.6.2.2 to 11.6.2.1.
This needs to be changed to work with more than Number. Ideally this operation is delayed until the type is determined. As an example the following should be intuitively legal without any Number conversion done.
let a:uint64 = 0xffffffffffffffff;
The same could be true for bigint support.
The table needs to be updated with all the new types and nullable type explanation.
Not sure if something needs to be changed in these.
Theese contain the operator definitions. Would probably need to include at least a brief change to explain the behavior of all the types. SIMD ones would require the most explanation.
Type casting syntax described above would need to be included.
Would need to cover the optional typing syntax and grammar.
CatchParameter needs to be modified to allow type constraints.
Function overloading would need to be included and the expected operations for matching a list of arguments to parameters and types. This will also need to cover cases like ambiguous function overloading.
The grammar rule ArrowFunction needs an optional return type and ArrowParameters needs optional type information per each parameter.
Grammar requires typing information as defined above. Specifically MethodDefinition's first rule and the get and set ones.
Grammar requires typing information for members and methods. Specifically ClassElement and MethodDefinition. ConstructorMethod is referenced as being a MethodDefinition so it should be fine after the MethodDefinition changes.
Needs to support type information in the constructor. Examples from the documentation with typed examples:
new Function("a:string", "b:uint8", "c:int32", "return a + b + c;")
new Function("a:string, b:uint8, c:int32", "return a + b + c;")
new Function("a:string,b:uint8", "c:int32", "return a + b + c;")
Syntax to define a return type:
new Function("a:string", "b:uint8[]", "c:int32", ":string", "return a + b + c;")
As described before each type needs a parse function to turn a string into the type. Also for float and decimal .EPSILON needs defined in their section. Also for all the integer (not bigint), float, and decimal types need MIN_VALUE and MAX_VALUE defined in their section.
All the math operations need to be overloaded to work with the integer, float, and decimal types. Meaning if they take in the type they should return the same type.
Similar to Function the constructor needs to be changed to allow types. For example:
new GeneratorFunction("a:float32", ":float32", "yield a * 2;");