Mason is designed to reduce the syntax of JavaScript (JS) and expand its capabilities.
Its goals are:
- Be syntactically light. No
{ } ( ) , ;
all over the place. Everything JS can do, Mason can do better.
The core language is just JavaScript with new syntax. You can convert a JS project to Mason without changing the design at all.
- Mason uses a mandatory standard library a small one called msl to provide basic functionality missing from JS. Many of msl's functions are builtins, values that are accessed like globals but are implicitly imported.
- Don't impose any style. Mason isn't X-oriented for any X. It adds new features but doesn't force you to use any of them.
So what features does it add? You'll read them all in the tour, but here's a preview:
- Builder syntax for constructing objects, lists, and maps. It's also a nice syntax for declarative data.
- Most statements (such as
if
,switch
, etc.) are also values. - Assertions.
- Polymorphs: functions that can be polymorphically implemented by many types, including builtin types.
- Traits: abstract types that support multiple inheritance and can be safely implemented by builtin types.
- Type declaration syntax.
- Async functions.
Planned features:
- HTML construction syntax (like JSX but not bound to any framework, good for both client and server)
- Discriminated union syntax (actually just a class heirarchy)
- Class properties
- Decorators
It's under active development here.
Have a comment about the language? Create an issue or Chat on gitter or contact me directly.