mambascript 0.5.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +326 -0
- package/README.md +509 -267
- package/bin/mamba +1 -258
- package/decision.js +1 -246
- package/docs/coverage.md +70 -0
- package/docs/features.md +3348 -0
- package/docs/perf.md +94 -0
- package/docs/reference.md +1295 -0
- package/docs/vs-coffeescript.md +1593 -0
- package/docs/vs-iced-coffeescript.md +626 -0
- package/docs/vs-typescript.md +107 -0
- package/esm.js +8 -0
- package/jest.js +33 -0
- package/lib/black.js +17 -13
- package/lib/browser.js +2 -4
- package/lib/cli.js +207 -136
- package/lib/compiler.js +1162 -93
- package/lib/decision.js +10 -10
- package/lib/diagnostics.js +219 -0
- package/lib/esm-hooks.js +60 -0
- package/lib/fast-parser.js +3469 -0
- package/lib/functional-helpers.js +26 -9
- package/lib/helpers.js +67 -50
- package/lib/js-nodes.js +151 -12
- package/lib/lexer.js +1499 -0
- package/lib/light-module.js +200 -63
- package/lib/mamba.js +372 -0
- package/lib/module.js +23 -172
- package/lib/nodes.js +84 -21
- package/lib/optimiser.js +29 -9
- package/lib/optparse.js +32 -15
- package/lib/parser.js +9433 -4840
- package/lib/preprocessor.js +3 -5
- package/lib/register.js +49 -56
- package/lib/repl.js +28 -9
- package/lib/reporter.js +106 -69
- package/lib/run.js +3 -5
- package/lib/string-scanner.js +94 -0
- package/lib/syntax-tables.js +480 -0
- package/lib/type-checker.js +258 -44
- package/lib/type-helpers.js +28 -10
- package/lib/type-resolver.js +256 -34
- package/lib/type-scope.js +10 -6
- package/lib/type-walker.js +664 -85
- package/lib/types.js +17 -7
- package/lib/underscore.js +170 -76
- package/lib/unicode-classes.js +122 -0
- package/mambaview.js +1 -0
- package/package.json +49 -46
- package/stdlib.js +1 -0
- package/vendor/README.md +40 -0
- package/vendor/escodegen/LICENSE.BSD +19 -0
- package/vendor/escodegen/escodegen.js +2289 -0
- package/vendor/estraverse/LICENSE.BSD +19 -0
- package/vendor/estraverse/estraverse.js +706 -0
- package/vendor/mambacodegen/LICENSE +24 -0
- package/vendor/mambacodegen/lib/mscodegen.js +620 -0
- package/vendor/patches/escodegen.diff +130 -0
- package/vendor/patches/estraverse.diff +51 -0
- package/vendor/patches/pegjs.diff +70 -0
- package/vendor/patches/source-map.diff +160 -0
- package/vendor/source-map/LICENSE +28 -0
- package/vendor/source-map/lib/source-map/array-set.js +92 -0
- package/vendor/source-map/lib/source-map/base64-vlq.js +140 -0
- package/vendor/source-map/lib/source-map/base64.js +38 -0
- package/vendor/source-map/lib/source-map/binary-search.js +77 -0
- package/vendor/source-map/lib/source-map/source-map-consumer.js +404 -0
- package/vendor/source-map/lib/source-map/source-map-generator.js +229 -0
- package/vendor/source-map/lib/source-map/source-node.js +201 -0
- package/vendor/source-map/lib/source-map/util.js +57 -0
- package/vendor/source-map/lib/source-map.js +8 -0
- package/bin/fix +0 -17
- package/bin/updateImports +0 -46
- package/build.js +0 -25
- package/lib/module-esm.js +0 -901
- package/lib/pegjs-kofu-plugin.js +0 -35
- package/lib/pegjs-mamba-plugin.js +0 -35
- package/lib/processor-esm.js +0 -507
- package/mamba +0 -259
- package/msast.js +0 -1
- package/utils/gulp-mamba.js +0 -29
- /package/{lib/esm.js → vendor/patches/mambacodegen.diff} +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.0.0 — 2026-12-06
|
|
4
|
+
|
|
5
|
+
MambaScript 2.0 is the "final form" release: the language reads like a sentence,
|
|
6
|
+
the type checker actually speaks up, the package has **zero runtime
|
|
7
|
+
dependencies**, the parser is hand-written and fast, and every feature is
|
|
8
|
+
documented next to the JavaScript it becomes and proven by tests that run under
|
|
9
|
+
both parsers. Two sibling applications, three rebuilt sites, a book and a
|
|
10
|
+
course corpus compile and run against it.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
**The language**
|
|
15
|
+
|
|
16
|
+
- **Sentence keywords**: `waitForIt` (await, implicit async), `waitForAll`
|
|
17
|
+
(await `Promise.all`), `panic` (throw), `attempt` / `onFail` / `regardless`
|
|
18
|
+
(try / catch / finally), `complain` (`console.warn`), `otherwise` (else and
|
|
19
|
+
the default branch of `consider`), `keepGoing` (continue), `bail` (break),
|
|
20
|
+
`consider` (switch), `x exists` (existential check), `a orElse b` (existential
|
|
21
|
+
default), `aint` (isnt), `nothing` (null), `missing` (undefined),
|
|
22
|
+
`obj has 'key'` (`'key' in obj`), `grab … from …` (require), `share …`
|
|
23
|
+
(module.exports) and `make` (new).
|
|
24
|
+
- **Async/await**: a function whose body contains `waitForIt` or `waitForAll` is
|
|
25
|
+
emitted as `async function`; a top-level `waitForIt` wraps the program (or is
|
|
26
|
+
a top-level `await` in an ES module).
|
|
27
|
+
- **ES modules**: `grab`/`share` stay the syntax; `modules: 'esm'` (API),
|
|
28
|
+
`mamba -c --esm` or a `"type": "module"` package produce `import`/`export`:
|
|
29
|
+
`grab x from 'm'`, `grab {a, b: c} from 'm'`, `grab * as ns from 'm'`,
|
|
30
|
+
`grab 'm'`, `share X` (default), `share {a, b}`, `share {name: expr}`,
|
|
31
|
+
`share {a, b} from 'm'`, `share * from 'm'`, and `waitForIt import('m')` in
|
|
32
|
+
both modes. ES-module output is bare, imports first, the stdlib imported.
|
|
33
|
+
CommonJS output is unchanged (the new forms lower to `require`). Node runs
|
|
34
|
+
`.mamba` files as ES modules through `node --import mambascript/esm.js app.mamba`
|
|
35
|
+
(`esm.js`, `lib/esm-hooks.js`); `mamba app.mamba` picks the mode from
|
|
36
|
+
`package.json`; the jest transform emits ES modules when jest runs in ESM
|
|
37
|
+
mode. Errors MS3001–MS3004 cover nested grab patterns, grab/share below the
|
|
38
|
+
top level, two default shares (or a default after named shares in CommonJS)
|
|
39
|
+
and `grab *` without `as`. `-z/--svelte` is an alias of `--esm`.
|
|
40
|
+
- **Generators**: a function that contains `yield` is a generator; `yield`
|
|
41
|
+
receives the value passed to `next`, `yield from` delegates, the last
|
|
42
|
+
expression is the final value. `for x from iterable` / `forEvery x from …`
|
|
43
|
+
walk any iterable (also as comprehensions, with `when`). A function with both
|
|
44
|
+
`waitForIt` and `yield` is an async generator; `forEvery waitForIt x from
|
|
45
|
+
source` is `for await`. Bound generators (`=>` with `yield`) keep `@`. A loop
|
|
46
|
+
in tail position of a generator collects through `yield*`; end the generator
|
|
47
|
+
with `return` when the values are not wanted. Errors MS4001–MS4003.
|
|
48
|
+
- **Tagged template literals**: a string glued to a value (`upper"hello
|
|
49
|
+
#{name}"`, `sql"""…"""`, `a.b"x"`, `f()"x"`) calls it with the string pieces
|
|
50
|
+
(and `strings.raw`) and the interpolated values. `tag "x"` with a space stays a
|
|
51
|
+
call; `` tag`x` `` is an error with a hint (MS1132).
|
|
52
|
+
- **Object rest and spread**: `{id, password, safe...} = user` collects the keys
|
|
53
|
+
the pattern did not name (own enumerable keys, shallow); `{defaults...,
|
|
54
|
+
options..., version: 2}` copies objects into a literal in source order, later
|
|
55
|
+
keys winning; `nothing`/`missing` spread adds nothing; `{@state..., c: 3}`,
|
|
56
|
+
`{{a: 1}..., b: 2}` and `{(f x)..., c: 3}` spread members of `this`, objects
|
|
57
|
+
written in place and parenthesised expressions. The dots go after the
|
|
58
|
+
expression, as in `f args...`; `{...a}` gets a hint (MS1128); a second
|
|
59
|
+
`rest...` is an error (MS1302).
|
|
60
|
+
- **Destructuring defaults**: `{name, age = 18, address: {city = 'NYC'}} =
|
|
61
|
+
person`, `[first = 'a', second] = letters`, `({a = 1}) ->`, loop variables and
|
|
62
|
+
`onFail` patterns. A default applies when the value is `nothing` or `missing`
|
|
63
|
+
(the same `== null` rule as parameter defaults), runs only when needed, left
|
|
64
|
+
to right, and may use names bound earlier in the pattern. `x = {a = 1}` in
|
|
65
|
+
value position is an error (MS1301).
|
|
66
|
+
- **Computed object keys**: `{[key]: 10, ["#{key}Max"]: 100, total: 1}` keeps
|
|
67
|
+
source order and evaluates each key once; `{[key]: v} = obj` reads `obj[key]`.
|
|
68
|
+
Braces are required (MS1129).
|
|
69
|
+
- **Labeled loops**: `rows: forEvery row, r in grid` on its own line labels the
|
|
70
|
+
loop; `bail rows` / `keepGoing rows` leave or advance it from a nested loop.
|
|
71
|
+
As a value (the last line of a function) the line stays an implicit object,
|
|
72
|
+
and `bail name` with no enclosing label says so (MS1131).
|
|
73
|
+
- **Numeric separators and BigInt**: `1_000_000`, `0b1010_1010`; `10n`, `0xFFn`,
|
|
74
|
+
`9_007_199_254_740_993n` printed verbatim. BigInt literals have the `BigInt`
|
|
75
|
+
type; mixing a BigInt with an Int in arithmetic is a type error (MS2007).
|
|
76
|
+
Misplaced separators and fractional BigInts are diagnostics.
|
|
77
|
+
- `make(X).method()` constructs `X` and then calls the method, as CoffeeScript's
|
|
78
|
+
`new(X).method()` (the fast parser used to construct `X.method`).
|
|
79
|
+
- **Typed `@` parameters**: `constructor: (@name :: String, @age :: Int = 1) ->`
|
|
80
|
+
(the checker does not yet check calls against the annotation; see todos).
|
|
81
|
+
- Regular expressions accept every JavaScript flag (`g i m s u y d v`).
|
|
82
|
+
- Spreads accept any iterable: `[m.values()...]`, `Math.max set...`,
|
|
83
|
+
`f iterator...` lower to `Array.from(x)`.
|
|
84
|
+
|
|
85
|
+
**Types and diagnostics**
|
|
86
|
+
|
|
87
|
+
- **The checker checks what it claimed to** (2026-12-05, after the corpora and the docs pages found
|
|
88
|
+
the gaps): the value of an `if`, `consider` or comprehension must agree with the annotation in
|
|
89
|
+
every branch (`n :: Int = if c then 1 else ''` is MS2001, as is a mixed list `xs :: Int[] = [1,
|
|
90
|
+
'two']`; a list of objects that differ only in optional members fits `Day[]`); nested `return`s
|
|
91
|
+
and method bodies are checked against the declared return type; `implements` requires the
|
|
92
|
+
blueprint to define every member of the struct (MS2008); the typed parameters of a constructor
|
|
93
|
+
give `make` its argument types; an instance carries the constructor's `@` members, so `{x, y} =
|
|
94
|
+
pt` type-checks; `@` inside a plain `->` callback is `Any` (a method's `@` stays the instance); a
|
|
95
|
+
pattern member with a default, and a struct member typed `T[]?`, may be missing; generic
|
|
96
|
+
functions work when declared on one line (`identity<T> :: T -> T = (x) -> x`), when called
|
|
97
|
+
without type arguments (the parameters are `Any` for that call), with structural return types
|
|
98
|
+
(`T -> {v :: T}`), with generic return types (`T -> Box<T>` is `Box<Int>` at `wrap<Int> 1`) and
|
|
99
|
+
with array type arguments (`Box<String[]>`), none of which crash the checker any more. Arrays
|
|
100
|
+
nest: `String[][]`, `Int[][][]` and `Box<Int[][]>` are types, a list literal of lists is inferred
|
|
101
|
+
as one, a loop variable or a destructured row is one level down, and depths must match
|
|
102
|
+
(`grid :: String[][] = ['a']` is MS2001). A member the type does not have is an error (MS2009
|
|
103
|
+
"Point has no member z"): on structs, on blueprint instances whose parents are known, and on `@`
|
|
104
|
+
inside such a blueprint; members defined anywhere in the blueprint, inherited, implemented, patched
|
|
105
|
+
through `::` or assigned to an object from outside count as known, and blueprints extending
|
|
106
|
+
something the checker cannot see, object literals and `Any` values stay open.
|
|
107
|
+
- **Type checking that reports**: errors print `file:line:col TypeError` with a
|
|
108
|
+
code frame (`x is declared as Int, but this value is String`). Modes `off` /
|
|
109
|
+
`warn` (default) / `error`; `--strict` and `--no-typecheck` on both CLIs;
|
|
110
|
+
`MAMBA_TYPECHECK` for the `require` hook and jest; `MambaScript.TypeError` is a
|
|
111
|
+
real `Error` subclass carrying `.errors` and `.file`. The walker visits
|
|
112
|
+
`while`, `try`, logical and comparison operators, string interpolation, soaked
|
|
113
|
+
calls and everything else it used to skip.
|
|
114
|
+
- **Error messages rewritten**: every diagnostic renders as `file:line:col Kind
|
|
115
|
+
headline`, a code frame with the whole span underlined (and the opener's
|
|
116
|
+
frame for an unclosed bracket), a paragraph on why, a `Fix:` with a concrete
|
|
117
|
+
rewrite built from the program's own names, and a `See` link to a stable code
|
|
118
|
+
(`MS1101` …) on the errors reference. Syntax errors name the construct
|
|
119
|
+
(`the right side of + is missing`, `this line is indented but nothing opened a
|
|
120
|
+
block`, `import is JavaScript; MambaScript spells it grab`, `=== is
|
|
121
|
+
JavaScript; MambaScript spells it is`, `// is not an operator`); unclosed
|
|
122
|
+
brackets show where they were opened; keyword assignments are explained;
|
|
123
|
+
`__NAME__` is reserved for macros. `mamba --json` prints diagnostics as JSON
|
|
124
|
+
for editors. `src/diagnostics.mamba` holds the renderer and the catalogue;
|
|
125
|
+
`tdd/errors/*.expected.txt` snapshot every rendering;
|
|
126
|
+
`tdd/lang/error-messages.spec.mamba` checks that every code has a test whose
|
|
127
|
+
`Fix:` compiles.
|
|
128
|
+
|
|
129
|
+
**Compiler and tooling**
|
|
130
|
+
|
|
131
|
+
- **Hand-written lexer and parser** (`src/lexer.mamba`, `src/fast-parser.mamba`)
|
|
132
|
+
replace the preprocessor + PEG.js pipeline as the default, building the same
|
|
133
|
+
tree with the same positions. Parsing is about 150x faster (15 MB/s against
|
|
134
|
+
100 KB/s); the back end was then made 3x faster (a full compile with type
|
|
135
|
+
checking runs at over 500 KB/s, byte-identical output). `--parser peg` and
|
|
136
|
+
`MAMBA_PARSER=peg` select the previous parser, kept for one release as a
|
|
137
|
+
fallback and as the oracle for `scripts/parity.js`; `mambascript --tokens`
|
|
138
|
+
prints the token stream.
|
|
139
|
+
- **Built-in globals** `present`, `complain` and `_` are declared with a real
|
|
140
|
+
`var` when a program uses them. **Standard library**: `_` (Underscore ported
|
|
141
|
+
to MambaScript) is auto-available as `var _ = require('mambascript/stdlib')`,
|
|
142
|
+
also `MambaScript.stdlib`; added `_.cloneDeep` and `_.once`.
|
|
143
|
+
- **Automatic `require` hook** (`require 'mambascript'` or `node -r
|
|
144
|
+
mambascript` registers `.mamba`); entry points `mambascript/stdlib`,
|
|
145
|
+
`mambascript/mambaview`, `mambascript/register`, `mambascript/jest`,
|
|
146
|
+
`mambascript/esm`; `MambaScript.BlackMamba` is an alias of `MambaView`.
|
|
147
|
+
- **`mamba init <dir>`** scaffolds a project; `mamba -p`, `--esm` and `--cjs`
|
|
148
|
+
imply `-c`; `--json` for editors.
|
|
149
|
+
- **Build**: `scripts/build.js` performs a three-stage self-hosted bootstrap to
|
|
150
|
+
a byte-identical fixpoint, runs smoke tests, the parity gate (both parsers),
|
|
151
|
+
the compat gate over the sister projects (both parsers) with the golden gate
|
|
152
|
+
(`scripts/compat.js --golden lib`: the new compiler's JavaScript must equal
|
|
153
|
+
the committed compiler's on every sister file unless `scripts/golden-allow.txt`
|
|
154
|
+
says so), swaps `lib/` atomically, runs jest, the coverage-matrix gate and the
|
|
155
|
+
sister suites, and rolls back if anything fails. `scripts/perf-gate.js`
|
|
156
|
+
enforces the speed in CI; `npm run profile`, `npm run bench`, `npm run
|
|
157
|
+
bench:ts` (against TypeScript), `npm run golden`, `npm run coverage`.
|
|
158
|
+
`MAMBA_LIB=lib.stage2` runs the whole suite against a build that has not been
|
|
159
|
+
swapped in.
|
|
160
|
+
- **Tests**: `tdd/lang` (conformance suites for every feature, both parsers,
|
|
161
|
+
output executed; the CLI through child processes), `tdd/legacy` (the 695 0.x
|
|
162
|
+
tests behind an adapter), `tdd/course` (the Super Coder prep library: 13
|
|
163
|
+
JavaScript and 19 algorithm files, every assertion kept), `tdd/ydkjs` (an
|
|
164
|
+
original suite over every topic of You Don't Know JS, 315 tests), `tdd/book`
|
|
165
|
+
(Smooth MambaScript, restored under `book/` and run chapter by chapter against
|
|
166
|
+
its expected output), `tdd/golden` (35 JavaScript baselines), `tdd/errors`
|
|
167
|
+
(rendered-diagnostic snapshots), `tdd/parser` (parity, positions, tables),
|
|
168
|
+
`tdd/skill.spec.mamba` (the agent skill's examples compile). 2480 tests.
|
|
169
|
+
- **Docs**: rewritten README, `docs/reference.md` (every construct next to its
|
|
170
|
+
JavaScript, the error-code table generated from the catalogue),
|
|
171
|
+
`docs/coverage.md` (one row per feature with its page, specs and example; the
|
|
172
|
+
build fails when a row is missing), `docs/vs-typescript.md` and `docs/perf.md`
|
|
173
|
+
(measured against TypeScript 5.9), `docs/briefs/` (how the sibling projects
|
|
174
|
+
were produced), `tdd/AUTHORING.md` (how to write corpora),
|
|
175
|
+
`skills/mambascript/` (a Claude Code skill that writes MambaScript the
|
|
176
|
+
readable way and comments every fancy form with a docs link).
|
|
177
|
+
- VS Code extension `language-mambascript` 0.1.0 and the Atom package highlight
|
|
178
|
+
every keyword (separate repositories).
|
|
179
|
+
|
|
180
|
+
### Changed
|
|
181
|
+
|
|
182
|
+
- All runtime dependencies are gone. escodegen 0.0.28, estraverse 1.3.2,
|
|
183
|
+
source-map 0.1.11 and mambacodegen 0.1.1 are vendored under `vendor/` (patched
|
|
184
|
+
in-house: `async`, generators, template literals, `for … of`,
|
|
185
|
+
`import`/`export`); the pinned pegjs commit lives under `tools/pegjs/` as a
|
|
186
|
+
build tool. lodash → the stdlib, nopt and kofu-optimist → `src/optparse.mamba`,
|
|
187
|
+
StringScanner → `src/string-scanner.mamba`, colors → the `colourise` helper.
|
|
188
|
+
- `bin/mamba` is generated from `src/mamba.mamba`; `module.mamba` is a thin
|
|
189
|
+
layer over `light-module.mamba`; the type scope and reporter are reset on every
|
|
190
|
+
compile (`persistScope: yes` keeps the REPL's state); root `decision.js` is
|
|
191
|
+
regenerated from `lib/decision`; `engines.node` is `>=18`.
|
|
192
|
+
- **Range loops**: a range is counted directly (no intermediate array) in the
|
|
193
|
+
direction of its bounds (`[10..0]` counts down; `[a..b]` decides at run time)
|
|
194
|
+
or of its step: a negative step counts down, a written `by 1` pins the count
|
|
195
|
+
upwards, a step with the wrong sign gives no iterations, a negative step over a
|
|
196
|
+
list walks it from the end, and a non-literal bound or step is read once
|
|
197
|
+
before the loop.
|
|
198
|
+
- **`regardless` only runs**: the value of `attempt` comes from its body or its
|
|
199
|
+
`onFail`, as JavaScript's `finally` works (the last expression of `regardless`
|
|
200
|
+
used to be returned).
|
|
201
|
+
- **`arguments` inside a collected loop** means the enclosing function's
|
|
202
|
+
arguments, not the collecting helper's.
|
|
203
|
+
- **`when not x` filters** compile to `if (x) continue`; a `struct` definition
|
|
204
|
+
leaves no `0;` behind; a name assigned twice at the top level is declared
|
|
205
|
+
once; bare output declares the temporaries its top level uses (`cache$`);
|
|
206
|
+
`o[key()] or= v`, `and=` and `?=` evaluate a computed target once; a
|
|
207
|
+
`blueprint` declared inside a function gets its `var`.
|
|
208
|
+
- Compile-stage errors render as diagnostics too; the parity gate treats "both
|
|
209
|
+
parsers reject" as agreement and pins error positions to the fast parser's.
|
|
210
|
+
- REPL: Ctrl-V multiline mode and `.history` work with today's Node (`getPrompt()`,
|
|
211
|
+
`defineCommand`).
|
|
212
|
+
|
|
213
|
+
### Fixed
|
|
214
|
+
|
|
215
|
+
- A spread in a `super` call (`super args...`, `super 'x', args...`) crashed the compiler with an
|
|
216
|
+
internal error; it compiles to `.apply(this, …)` in constructors, methods and statics.
|
|
217
|
+
- `x = await p` and `f = async -> 1`, written by JavaScript habit, compiled to calls of undefined
|
|
218
|
+
functions; they are MS1124 with the `waitForIt` fix (fast parser; the PEG fallback still reads
|
|
219
|
+
them as calls).
|
|
220
|
+
- Type errors were silently dropped (`has_errors` always returned false).
|
|
221
|
+
- Generated symbols at the top level of bare programs were never declared
|
|
222
|
+
(an implicit global, a ReferenceError in strict code and in ES modules).
|
|
223
|
+
- A function whose inline body is an object or array with a spread
|
|
224
|
+
(`(o) -> {o..., k: 1}`) crashed the compiler; `make(f x).prop` and a typed
|
|
225
|
+
function assigned to an imported constructor's member crashed the type
|
|
226
|
+
walker; a rest parameter with an `Any` pre-annotation crashed it.
|
|
227
|
+
- The optimiser deleted `nothing orElse f()` as dead code.
|
|
228
|
+
- `7 // 2` compiled to an empty regular expression applied as a call; it is now
|
|
229
|
+
MS1025 with the `Math.floor(a / b)` fix.
|
|
230
|
+
- `===` and `!==` reported "unexpected '='"; `x or= v` on an unassigned name
|
|
231
|
+
spoke of `?=`.
|
|
232
|
+
- MambaView's and Decision's tag tables carried newlines in `button`, `em`,
|
|
233
|
+
`hgroup`, `object`, `section`, `tfoot` and `param`; MambaView's `'#id.class'`
|
|
234
|
+
shorthand threw inside compiled templates; `dialog`, `picture`, `search`,
|
|
235
|
+
`slot`, `template` and the basic SVG elements are new.
|
|
236
|
+
- The fast parser rejected keywords as implicit object keys (`label for:
|
|
237
|
+
'email'`), `make X` followed by an indented implicit object, a trailing dot
|
|
238
|
+
continuing a member access on the next line, a spread of an object written in
|
|
239
|
+
place, and a typed `@` parameter; the PEG parser crashed on a slice as an
|
|
240
|
+
assignment target.
|
|
241
|
+
- Raw mode no longer crashes on a member access whose object is a sliced
|
|
242
|
+
comprehension; a comprehension may iterate over another comprehension; a
|
|
243
|
+
declared return type is kept instead of being replaced by the inferred body
|
|
244
|
+
type; an array of untyped values (`Any[]`) fits any array type.
|
|
245
|
+
- stdlib: `_.flatten`, `_.range`, `_.template` and `_.bind` were broken in the
|
|
246
|
+
port. The option parser could not consume a flag's argument; `--no-<flag>` is
|
|
247
|
+
understood by both CLIs.
|
|
248
|
+
- Line numbers after a backslash-newline inside a string are correct; `offset`
|
|
249
|
+
and `range` are offsets into the original file; indented member chains keep
|
|
250
|
+
every access; `super(...)` can be followed by accesses; `f (a)` with a space
|
|
251
|
+
no longer crashes the parser.
|
|
252
|
+
- The `mambascript/jest` cache key includes the compiler's own files, so a
|
|
253
|
+
project that links a checkout is never served output from the previous build.
|
|
254
|
+
|
|
255
|
+
### Removed
|
|
256
|
+
|
|
257
|
+
- `--minify` (esmangle), `--nodejs`, the `--svelte`/`--typed2cs` placeholders
|
|
258
|
+
and the `--watch` stub from `mambascript`; the `coffeescript` package and the
|
|
259
|
+
`--self` switch (`.coffee` files compile through MambaScript itself).
|
|
260
|
+
- Dead files: root `build.js`, root `mamba`, `msast.js`, `lib/esm.js`,
|
|
261
|
+
`lib/module-esm.js`, `lib/processor-esm.js`, `lib/prodParser.js`,
|
|
262
|
+
`lib/pegjs-mamba-plugin.js`, `bin/updateImports`, `utils/gulpfile.js`,
|
|
263
|
+
`utils/gulp-mamba.js`, `utils/msast.*`, `utils/kocky.cr`, `examples/compiled/`,
|
|
264
|
+
the Makefile bootstrap.
|
|
265
|
+
|
|
266
|
+
### Deprecated
|
|
267
|
+
|
|
268
|
+
- The PEG parser, `src/preprocessor.mamba` and `tools/pegjs/`; removed in the
|
|
269
|
+
next release. `src/grammar.pegjs` stays as the reference grammar
|
|
270
|
+
(`tdd/parser/tables.spec.mamba` checks the tables against it). Known PEG
|
|
271
|
+
deviations are listed in `tdd/parser/parity-exceptions.txt`.
|
|
272
|
+
|
|
273
|
+
### Breaking
|
|
274
|
+
|
|
275
|
+
- New reserved words: `waitForIt`, `waitForAll`, `panic`, `attempt`, `onFail`,
|
|
276
|
+
`regardless`, `otherwise`, `keepGoing`, `bail`, `consider`, `exists`,
|
|
277
|
+
`orElse`, `aint`, `nothing`, `missing`, `has`, `grab`, `share`, `make`, plus
|
|
278
|
+
`yield` and `as` in their positions. Rename any variable using one of them
|
|
279
|
+
(`from` stays usable; it is only a keyword after `grab` and in `for … from`).
|
|
280
|
+
- `complain` and `_` are built-ins; a program that assigns them keeps its own
|
|
281
|
+
value and gets no injection. The `present` declaration is a real statement.
|
|
282
|
+
- Type warnings print (to stderr); `--no-typecheck` or `MAMBA_TYPECHECK=off`
|
|
283
|
+
silences them. `MambaScript.parse` rethrows `TypeError` objects instead of
|
|
284
|
+
bare strings; `typeCheck: 'error'` makes them throw.
|
|
285
|
+
- Not CoffeeScript: `===`/`!==` and `//` are errors with hints; a slice is not an
|
|
286
|
+
assignment target (use `splice`); `while … when` guards, holes in array
|
|
287
|
+
patterns, `.5`, a trailing comma continuing an implicit call, and an indented
|
|
288
|
+
operand after a trailing operator are rejected; `panic 'text'` throws an
|
|
289
|
+
`Error`; `bail` inside `consider` leaves the consider (label the loop); a line
|
|
290
|
+
starting with `.` continues the innermost expression (wrap a trailing callback
|
|
291
|
+
to chain past it); strings may span lines and keep the line break.
|
|
292
|
+
- Behaviour changes from the fixes above: a range with a variable end counts
|
|
293
|
+
down when the end is below the start (write `by 1` to count up only); a
|
|
294
|
+
spread of a sparse array fills the holes and a spread of a string walks code
|
|
295
|
+
points (`Array.from`); the last expression of `regardless` is no longer the
|
|
296
|
+
value of `attempt`; `arguments` inside a collected loop is the enclosing
|
|
297
|
+
function's.
|
|
298
|
+
|
|
299
|
+
Unchanged for existing projects: `require('mambascript').register()`,
|
|
300
|
+
`{MambaView} = require 'mambascript'`, `Decision = require 'mambascript/decision'`
|
|
301
|
+
and `Decision(React).$`.
|
|
302
|
+
|
|
303
|
+
### Verified against
|
|
304
|
+
|
|
305
|
+
- `../mamba-cookout`: the production private reference API rewritten in 2.0 (Express 5,
|
|
306
|
+
JWT, an in-memory Mongoose-shaped store, MambaView pages, a supertest suite
|
|
307
|
+
under both parsers and strict types).
|
|
308
|
+
- `../mamba-goat-cafe`: the goat-cafe full-stack application rebuilt in 2.0
|
|
309
|
+
(Express 5 API, Decision/React client, webpack through a MambaScript loader);
|
|
310
|
+
API, model, client and Playwright end-to-end parity proofs.
|
|
311
|
+
- `../mamba-sites`: three styled static sites (kingchrissy, Eleven28, Devonie's
|
|
312
|
+
trip) rebuilt in 2.0 with DOM, behaviour, asset and visual parity proofs.
|
|
313
|
+
- `../create-mamba-app`: the project generator (`npx create-mamba-app --template static|fullstack|api`),
|
|
314
|
+
whose templates are extracted from the three reference repositories and kept byte-identical to
|
|
315
|
+
them by its own sync tests; each generated project installs, checks and tests green.
|
|
316
|
+
- `../mambascript.org`: the site generator ported to 2.0 (registry-driven
|
|
317
|
+
build, eleven gates, the compiler bundled for the browser playground).
|
|
318
|
+
- The original `private-reference-api` (43 files of 0.5.x code), `../mamba-playground`
|
|
319
|
+
and `../bigpoppacode.io` compile under the compat gate; the sisters' suites
|
|
320
|
+
run at the end of every build. Open findings are in `todos.md`.
|
|
321
|
+
|
|
322
|
+
## 0.5.5
|
|
323
|
+
|
|
324
|
+
Last release of the 0.x line: CoffeeScript 2.5 dependency, `blueprint`,
|
|
325
|
+
`forEvery`, `also`, `thanos`, `areYouA`, MambaView and Decision, type checker
|
|
326
|
+
present but inert.
|