JS++ languagedormant
Typed JavaScript superset by Onux with an optional sound gradual type system: the Unified External Type walls off JS dynamics, C-style annotations hold at runtime, and integer types guarantee no NaN surprises.
Overview
JS++ extends JavaScript with an optional type system whose declared types are guaranteed to hold at runtime — sound gradual typing for untyped-library interop. Compilation erases types and emits JavaScript, keeping deployment identical.
Code
import System;
external jQuery, $; // one-line JS-library import
var offset = 0; // untyped: stays plain JavaScript
unsigned int pageHeight = $(document).height(); // guaranteed unsigned int
int[] rgb = [ 0xFF, 0xFA, 0xFF ]; // 32-bit ints, not doubles
int plus(int a, int b) { // overloading needs types
return a + b;
}
external imports stay JavaScript-dynamic; annotated variables keep their
types at runtime — annotations erase, guarantees compile in.Distinctive traits
- Unified External Type walls JavaScript's dynamics out of the checked region — no
anycontaminating soundness. - Guaranteed types: annotated values hold at runtime (patented approach), unlike erasure-only gradual systems.
- Real integer types (8–64-bit, signed/unsigned) over JavaScript's single double, with
int+existent types preventing out-of-bounds accesses at compile time. - Nominal classes compile statically; no ASI — semicolons are required, so brace style is free.
Status
Dormant: first release October 2011, modern implementation beta May 31 2016, stable reached 0.10.0 (December 2021) under a BSD license; compiler in C/C++ for Windows/macOS/Linux with no new release since.