exprforge 0.5.0 → 0.5.1
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/README.md +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -288,7 +288,7 @@ package individually, or together as `samples`):
|
|
|
288
288
|
fixture exercising every `exprforge/math` helper (see below) in one
|
|
289
289
|
suite.
|
|
290
290
|
- `samples/macro-demo.js` — also not a worked example: a conformance-test
|
|
291
|
-
fixture specifically for the
|
|
291
|
+
fixture specifically for the `` loadMacro(name, fn`...`) `` AST-function
|
|
292
292
|
tier, proving its internal gensym'd let-renaming produces valid
|
|
293
293
|
identifiers on every real target, not just `evaluate()` (which can't
|
|
294
294
|
see codegen at all — see "Macros and externs").
|
|
@@ -386,7 +386,7 @@ const rodrigues = fn`
|
|
|
386
386
|
Safe by construction — if `def` returns real `ast.js` Nodes, the result
|
|
387
387
|
is exactly as trustworthy as anything else this library emits. `def`
|
|
388
388
|
can also be an AST function definition directly (e.g. straight out of
|
|
389
|
-
|
|
389
|
+
`` fn`...` ``: `` loadMacro("foo", fn`foo(x): return x * 2;`) ``), sugar
|
|
390
390
|
for the same thing — this is exactly how "Examples, flashiest first"
|
|
391
391
|
above registers `cross3`.
|
|
392
392
|
|
|
@@ -418,10 +418,10 @@ const rodrigues = fn`
|
|
|
418
418
|
duplication matters to you.
|
|
419
419
|
|
|
420
420
|
- **`loadExtern(name, def)`** — `def` is a plain per-target mapping
|
|
421
|
-
object instead of a function, e.g.
|
|
422
|
-
=>
|
|
423
|
-
native call**, same mechanism as the 22 built-in primitives —
|
|
424
|
-
supplied by you instead of shipped here. Only the targets you provide a
|
|
421
|
+
object instead of a function, e.g.
|
|
422
|
+
`` { evaluate: (x) => ..., js: ([x]) => `myLib.f(${x})`, zig: ([x]) => `mylib.f(${x})` } ``.
|
|
423
|
+
A **real native call**, same mechanism as the 22 built-in primitives —
|
|
424
|
+
just supplied by you instead of shipped here. Only the targets you provide a
|
|
425
425
|
key for resolve; every other target still throws "no mapping" for that
|
|
426
426
|
name, same as an unmapped primitive. **ExprForge can't verify the named
|
|
427
427
|
symbol actually exists in a given target, or that it behaves
|
|
@@ -446,7 +446,7 @@ itself, and here's exactly what happens:
|
|
|
446
446
|
- **A macro can't call itself, directly or through a cycle.** This is
|
|
447
447
|
enforced two different ways depending on how the macro was defined, and
|
|
448
448
|
it's worth knowing which one applies: a macro defined as an AST
|
|
449
|
-
function (straight
|
|
449
|
+
function (straight `` fn`...` `` text, or every function in a `.expr`
|
|
450
450
|
file/buffer) is resolved and **inline-expanded once, at
|
|
451
451
|
registration/load time**, against whatever's registered so far — a
|
|
452
452
|
definition only becomes referenceable *after* it's fully registered,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exprforge",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Author a math expression once as an AST (or readable infix text via expr/fn), emit identical-behavior implementations in JS, TypeScript, Python, C#, Lua, QB64, C, Java, Go, Rust, Perl, PHP, Julia, Fortran, Zig, Scheme, and COBOL, plus a native evaluator and its own readable syntax printer.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|