Skip to content

Commit 35aad5f

Browse files
committed
MeTTaScript 2.0.3
1 parent 8d99d23 commit 35aad5f

40 files changed

Lines changed: 693 additions & 112 deletions

RELEASE_NOTES.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
# MeTTaScript 2.0.3
2+
3+
Adds an opt-in, deterministic work budget that bounds how much a single query is allowed to compute.
4+
Nothing changes for existing programs: the budget is off by default, matching Hyperon, so every terminating
5+
program produces the same output as 2.0.2, validated byte-identical on the conformance oracle and the full
6+
test suite. Upgrading from 2.0.2 is safe.
7+
8+
## A deterministic work budget
9+
10+
2.0.2 made recursion depth deterministic but noted a remaining gap: a depth bound bounds depth, not total
11+
work, so a broadly branching search such as the PLN proof search in `plntestdirect` could run a very long
12+
time. This release adds the tool to bound that, a per-query limit on the number of evaluation steps.
13+
14+
Set it three equivalent ways:
15+
16+
- In a program: `(pragma! mettascript-max-steps 1000000)`
17+
- As a run option: `maxSteps: 1000000`
18+
- On the CLI: `--max-steps 1000000`
19+
20+
When a query exceeds the budget, evaluation stops and yields `(Error <call> ResourceLimit)`. The marker is
21+
an ordinary value: it is catchable with `case`, and it does not abort the whole query, so every result
22+
produced before the limit is kept. A budget of `0` means unlimited, which is the default.
23+
24+
The cut is a function of the program and the budget alone. It counts logical evaluation steps, the same way
25+
on the interpreted and compiled paths, so a query is cut at exactly the same point regardless of the host's
26+
JavaScript stack size or which evaluator runs it. A test pins this: a broad search is cut at an identical
27+
step count and returns identical output across four V8 stack sizes and both evaluator paths.
28+
29+
## Why the name
30+
31+
The pragma is `mettascript-max-steps`, not `max-steps`, because it is a MeTTaScript extension with no
32+
Hyperon equivalent. That is deliberately distinct from `(pragma! max-stack-depth N)`, a real Hyperon pragma
33+
that MeTTaScript implements. Hyperon has no work or step limit of its own, so this budget is ours and named
34+
as such.
35+
36+
## Off by default
37+
38+
The budget is opt-in. With no budget set, evaluation is unbounded, exactly as before and exactly as Hyperon.
39+
A step budget is the right tool for bounding a search you know may not terminate, or for making a long
40+
computation deterministic under a resource cap. It is not imposed on programs that do a lot of legitimate
41+
work.
42+
143
# MeTTaScript 2.0.2
244

345
A correctness release. Recursion depth is now deterministic: a program's output no longer depends on how

compat/browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metta-ts/browser",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.js",

compat/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metta-ts/core",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.js",

compat/das-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metta-ts/das-client",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.js",

compat/das-gateway/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metta-ts/das-gateway",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.js",

compat/debug/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metta-ts/debug",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.js",

compat/edsl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metta-ts/edsl",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.js",

compat/grapher/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metta-ts/grapher",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.js",

compat/hyperon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metta-ts/hyperon",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.js",

compat/libraries/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metta-ts/libraries",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"license": "MIT",
55
"type": "module",
66
"main": "./dist/index.js",

0 commit comments

Comments
 (0)