Skip to content

Status and Roadmap

Congcong Cai edited this page Nov 2, 2024 · 167 revisions

High level status

  • Most of TypeScript's AOT-compatible syntax is supported
  • A managed runtime takes care of memory management and GC
  • Classes are more like C-structs with methods (no virtual overloads yet)
  • Standard library is functional but still needs more work
  • Throwing an exception terminates the entire program (needs WebAssembly/exception-handling)
  • We need more tests (pretty sure this will remain here)

High level goals

  • Get a memory manager and GC combo up and running
    • Memory manager (TLSF)
    • Automatic reference counting & garbage collection (PureRC)
  • Get a working standard library up (where AOT-compatible)
  • Improve linking, e.g. with C, based on what's supported by common tools
  • Compile the AssemblyScript compiler to WebAssembly using itself
  • Provide tools to automatically generate glue code and definitions

And, of course, keep up with the state of WebAssembly, most notably at this point:

Proposal Phase Status
Sign Extension Operations standardized --enable sign-extension
Mutable Globals standardized --enable mutable-global
Non-trapping float-to-int Conversions standardized --enable nontrapping-f2i
Bulk Memory Operations standardized --enable bulk-memory
Reference Types standardized --enable reference-types
Multi-Value standardized
SIMD implementation --enable simd
Threads implementation --enable threads
Tail Call implementation
Exception Handling implementation
Function References proposal
Interface Types proposal
Memory64 proposal
Wasm GC proposal

Standard library compatibility

AssemblyScript comes with its own lightweight standard library that aims to be as compatible as it can get to what you'd expect in the browser. The following table outlines what's implemented already:

Feature Notes

Globals

NaN ✓ Context-sensitive (f32 in f32 context, otherwise f64)
Infinity ✓ Context-sensitive (f32 in f32 context, otherwise f64)
isFinite ✓
isNaN ✓
parseFloat ✓
parseInt ✓
decodeURI ✓
decodeURIComponent ✓
encodeURI ✓
encodeURIComponent ✓

Number

There is no Number object in AssemblyScript, but one for each type instead.
EPSILON ✓
MIN_VALUE ✓
MAX_VALUE ✓
MIN_NORMAL_VALUE ✓ AssemblyScript specific
MIN_SAFE_INTEGER ✓
MAX_SAFE_INTEGER ✓
NaN ✓
NEGATIVE_INFINITY ✓
POSITIVE_INFINITY ✓
isFinite ✓
isInteger ✓
isNaN ✓
isSafeInteger ✓
parseFloat ✓
parseInt ✓
toExponential
toFixed
toLocaleString
toPrecision
toString ✓

Array

length ✓
at ✓
from
isArray ✓
of
concat ✓
copyWithin ✓
entries
every ✓ No closures yet
fill ✓
filter ✓ No closures yet
find
findLast
findIndex ✓ No closures yet
findLastIndex ✓ No closures yet
flat ✓ Partially
flatMap
forEach ✓ No closures yet
includes ✓
indexOf ✓
join ✓
keys
lastIndexOf ✓
map ✓ No closures yet
pop ✓
push ✓
reduce ✓ No closures yet
reduceRight ✓ No closures yet
reverse ✓
shift ✓
slice ✓
some ✓ No closures yet
sort ✓
splice ✓ Partially implement without inserting items
toLocaleString
toString ✓
unshift ✓
values
groupToMap Stage 3
[Symbol.iterator]

TypedArray

BYTES_PER_ELEMENT ✓
at ✓
buffer ✓
byteLength ✓
byteOffset ✓
length ✓
from
of
copyWithin ✓
entries
every ✓ No closures yet
fill ✓
filter ✓ No closures yet
find
findLast
findIndex ✓ No closures yet
findLastIndex ✓ No closures yet
forEach ✓ No closures yet
includes ✓
indexOf ✓
join ✓
keys
lastIndexOf ✓
map ✓ No closures yet
reduce ✓ No closures yet
reduceRight ✓ No closures yet
reverse ✓
set ✓
slice ✓
some ✓ No closures yet
sort ✓
subarray ✓
toLocaleString
toString ✓
values
[Symbol.iterator]

ArrayBuffer

✓
byteLength ✓
isView ✓
slice ✓
toString ✓

DataView

✓
buffer ✓
byteLength ✓
byteOffset ✓
getInt8 ✓
getUint8 ✓
getInt16 ✓
getUint16 ✓
getInt32 ✓
getUint32 ✓
getInt64 ✓ AssemblyScript specific
getUint64 ✓ AssemblyScript specific
getBigInt64 Required BigInt
getBigUint64 Required BigInt
getFloat32 ✓
getFloat64 ✓
setInt8 ✓
setUint8 ✓
setInt16 ✓
setUint16 ✓
setInt32 ✓
setUint32 ✓
setInt64 ✓ AssemblyScript specific
setUint64 ✓ AssemblyScript specific
setBigInt64 Required BigInt
setBigUint64 Required BigInt
setFloat32 ✓
setFloat64 ✓
toString ✓

String

length ✓
fromCharCode ✓
fromCharCodes ✓ AssemblyScript specific
fromCodePoint ✓
fromCodePoints ✓ AssemblyScript specific
UTF8 ✓ AssemblyScript specific (See docs)
UTF16 ✓ AssemblyScript specific (See docs)
dedent Stage 2
at ✓
charAt ✓
charCodeAt ✓
concat ✓
endsWith ✓
includes ✓
indexOf ✓
lastIndexOf ✓
localeCompare ✓ Very basic. Without locales and options
match
matchAll
normalize
padEnd ✓
padStart ✓
repeat ✓
replace ✓ Without Regexp and callback yet
replaceAll ✓
search
slice ✓
split ✓ Without Regexp
startsWith ✓
substr ✓
substring ✓
toLocaleLowerCase
toLocaleUpperCase
toLowerCase ✓
toUpperCase ✓
toString ✓
trim ✓
trimLeft/trimStart ✓
trimRight/trimEnd ✓
[Symbol.iterator]
raw

Symbol

✓
hasInstance ✓
isConcatSpreadable ✓
isRegExp ✓
match ✓
replace ✓
search ✓
species ✓
split ✓
toPrimitive ✓
toStringTag ✓
unscopables ✓
for ✓
keyFor ✓
toString ✓

Math

✓ This also applies to specific Mathf (single float point) version of Math
E ✓
LN10 ✓
LN2 ✓
LOG10E ✓
LOG2E ✓
PI ✓
SQRT1_2 ✓
SQRT2 ✓
sincos_sin ✓ AssemblyScript specific
sincos_cos ✓ AssemblyScript specific
abs ✓
acos ✓
acosh ✓
asin ✓
asinh ✓
atan ✓
atan2 ✓
atanh ✓
cbrt ✓
ceil ✓
clz32 ✓ Just for compatibility. Not recommended.
cos ✓
cosh ✓
exp ✓
exp2 ✓ AssemblyScript specific
expm1 ✓
floor ✓
fround ✓
hypot ✓
imul ✓ Just for compatibility. Not recommended.
log ✓
log10 ✓
log1p ✓
log2 ✓
max ✓
min ✓
pow ✓
random ✓
seedRandom ✓ AssemblyScript specific
round ✓
sign ✓
signbit ✓ Stage 1 Proposal
sin ✓
sincos ✓ AssemblyScript specific
sinh ✓
sqrt ✓
tan ✓
tanh ✓
trunc ✓

Map

size ✓
clear ✓
delete ✓
entries
emplace Stage 2 proposal
forEach
get ✓
has ✓
set ✓
keys ✓ Return array instead iterator currently
values ✓ Return array instead iterator currently
toString ✓
[Symbol.iterator]

Set

size ✓
add ✓
clear ✓
delete ✓
difference Stage 3 Proposal
entries
forEach
has ✓
intersection Stage 3 Proposal
isDisjointFrom Stage 3 Proposal
isSubsetOf Stage 3 Proposal
isSupersetOf Stage 3 Proposal
union Stage 3 Proposal
symmetricDifference Stage 3 Proposal
values ✓ Return array instead iterator currently
toString ✓
[Symbol.iterator]

WeakMap

delete
get
has
set
toString

WeakSet

add
delete
has
toString

Console

assert
clear
count
countReset
dir
error
group
groupCollapsed
groupEnd
info
log
table
time
timeEnd
trace
warn

JSON

parse
stringify

Object

is ✓
keys
assign
create
entries
getOwnPropertyNames
getOwnPropertySymbols
toString
values

Date

UTC ✓
now ✓
parse ✓ Only for ISO format
getDate
getDay
getFullYear
getHours
getMilliseconds
getMinutes
getMonth
getSeconds
getTime ✓
getTimezoneOffset
getUTCDate ✓
getUTCDay ✓
getUTCFullYear ✓
getUTCHours ✓
getUTCMilliseconds ✓
getUTCMinutes ✓
getUTCMonth ✓
getUTCSeconds ✓
setDate
setFullYear
setHours
setMilliseconds
setMinutes
setMonth
setSeconds
setTime ✓
setUTCDate ✓
setUTCFullYear ✓
setUTCHours ✓
setUTCMilliseconds ✓
setUTCMinutes ✓
setUTCMonth ✓
setUTCSeconds ✓
toDateString ✓
toISOString ✓
toJSON
toLocaleDateString
toLocaleString
toLocaleTimeString
toString ✓ Without timezone and local offset
toTimeString ✓ Without timezone and local offset
toUTCString ✓

Error

message ✓
name ✓
stack
toString ✓

Iterator / AsyncIterator

drop Iterator helpers proposal (Stage 2)
every Iterator helpers proposal (Stage 2)
from Iterator helpers proposal (Stage 2)
filter Iterator helpers proposal (Stage 2)
find Iterator helpers proposal (Stage 2)
flatMap Iterator helpers proposal (Stage 2)
forEach Iterator helpers proposal (Stage 2)
indexed Iterator helpers proposal (Stage 2)
map Iterator helpers proposal (Stage 2)
next
reduce Iterator helpers proposal (Stage 2)
return
take Iterator helpers proposal (Stage 2)
throw
toAsync Iterator helpers proposal (Stage 2)
toArray Iterator helpers proposal (Stage 2)
some Iterator helpers proposal (Stage 2)

Promise

all
allSettled
any
race
reject
resolve
catch
finally
then

RegExp

lastIndex
dotAll
flags
global
ignoreCase
multiline
source
sticky
unicode
exec
test
toString
[Symbol.replace]
[Symbol.search]
[Symbol.split]

Atomics

✓
add ✓
and ✓
compareExchange ✓
exchange ✓
fence ✓
isLockFree ✓
load ✓
notify ✓
or ✓
store ✓
sub ✓
wait ✓
wake ✓
xor ✓

SIMD (v128)

✓
const ✓
splat ✓
extract_lane(_u/_s) ✓
replace_lane ✓
shuffle ✓
swizzle ✓
add ✓
sub ✓
mul ✓
neg ✓
add_sat_(u/s) ✓
sub_sat_(u/s) ✓
shl ✓
shr_(u/s) ✓
and ✓
or ✓
xor ✓
not ✓
andnot ✓
bitselect ✓
any_true ✓
all_true ✓
bitmask ✓ Only i8x16/i16x8/i32x4
eq ✓
ne ✓
lt(_u/_s) ✓
le(_u/_s) ✓
gt(_u/_s) ✓
ge(_u/_s) ✓
load ✓
load_lane ✓
load_splat ✓
load_zero ✓
load8x8_(u/s) ✓
load16x4_(u/s) ✓
load32x2_(u/s) ✓
store ✓
store_lane ✓
abs ✓
min_(s/u) ✓ except i64x2
max_(s/u) ✓ except i64x2
min ✓ Only f32x4/f64x2
max ✓ Only f32x4/f64x2
pmin ✓ Only f32x4/f64x2
pmax ✓ Only f32x4/f64x2
ceil ✓ Only f32x4/f64x2
floor ✓ Only f32x4/f64x2
trunc ✓ Only f32x4/f64x2
nearest ✓ Only f32x4/f64x2
dot ✓ Only i16x8
avgr_u ✓ Only i8x16/i16x8
div ✓ Only f32x4/f64x2
sqrt ✓ Only f32x4/f64x2
convert_(u/s) ✓
convert_low ✓
trunc_sat_(s/u) ✓
trunc_sat_(s/u)_zero ✓
narrow_(u/s) ✓
extend_low ✓
extend_high ✓
extadd_pairwise_(u/s) ✓ Only i8x16/i16x8
extmul_low_(u/s) ✓
extmul_high_(u/s) ✓
demote_zero ✓ Only f64x2
promote_low ✓ Only f32x4
q15mulr_sat ✓ Only i16x8

BigInt

BigInt(str)
BigInt(num)
i32(bn), u32(bn)
i64(bn), u64(bn)
f64(bn), f32(bn)
asIntN
asUintN
!a
-a
~a
a++
a--
a & b
a | b
a ^ b
a + b
a - b
a * b
a / b
a % b
a ** b
a << b
a >> b
a >>> b
a == b
a != b
a > b
a < b
a >= b
a <= b
toLocaleString
toString

 

Clone this wiki locally