Repository navigation
Nift v4.13.0 — Runtime 2.0
Nift v4.13.0 introduces Runtime 2.0, a new bytecode virtual machine for
Nift's scripting surface. Runtime 2.0 is the default engine for script files,
-e/-c/stdin programs, nift eval, and interactive sessions. Website
templates continue to use the established legacy renderer, so ordinary Nift
website builds keep their existing behaviour and output.
Nift remains a website generator and dependency-aware build layer. Runtime 2.0
improves the scripting engine; it does not change that product boundary.
What is new
- A new default scripting engine. Runtime 2.0 compiles supported programs
before execution. Constructs outside the supported subset are refused before
any part of the program runs, with a source location where available (or the
script/start line otherwise) and a clear route back to the legacy engine.
There is no silent fallback. - Broad script coverage within the documented Runtime 2.0 subset. The
release is exercised across functions and closures, modules and package
imports, arrays, objects, collections and structs, reference and mutation
semantics, diagnostics, host operations and handles, parallel tasks, and
interactive sessions. - Package compatibility. The unchanged 12-module package regression suite
passes with Runtime 2.0 as the default, withNIFT_VM=require, and with
explicit legacy execution. The tested ecosystem includes integrations built
with SQLite, curl, ImageMagick and Vips. This is a tested package subset, not
a claim about every third-party package. - Safety and diagnostics. Runtime 2.0 keeps pre-execution refusal for
unsupported operations, checks runtime types and mutation operations, detects
reference cycles, manages typed resource handles, and reports failures with
source locations where available. - Platform coverage. Release validation includes Linux, macOS, Windows and
FreeBSD 14 amd64 qualification. Official binary archives are provided for
Linux x86-64, macOS arm64, macOS x86-64 and Windows x86-64.
Compatibility and migration
Runtime 2.0 is intentionally conservative where the VM cannot yet preserve
legacy behaviour. Unsupported programs are refused before execution rather than
run with different semantics. Use NIFT_VM=0 to run the legacy interpreter.
The main migration points are:
- File built-ins are qualified. In VM-run scripts and sessions, the seven
file built-inscat,cp,mv,rm,ls,mkdirandtouchare called
with thenative::qualifier, for examplenative::cp("a", "b"). An
unqualified call with no user or module function of that name is refused
before execution.NIFT_VM=0keeps the legacy spelling. - Some legacy script forms still require the legacy engine. These include
bare shell-command statements, stored or indirectly invoked async function
values, the file forms ofminify(), nested#!comments, general process
execution outside the documented package scope, FFI, timers, project/template
script APIs, dynamic imports, and legacy dynamic scope. The independent Nift
regression suite is the legacy compatibility contract and includes many of
these forms; validate legacy behaviour withNIFT_VM=0. See the Runtime 2.0
known-limitations documentation for the complete list. - C ABI 1.4 adds Runtime 2.0 program APIs.
nift_program_compile()and
nift_program_run()expose the VM program lifecycle and result metadata.
The change is additive: existing ABI 1.3 symbols, signatures and layouts remain
source compatible. - Sorted collections have a defined mixed-domain diagnostic. Inserting both
numeric and string keys into a sorted map, or both numeric and string members
into a sorted set, now fails withsorted_map: incomparable keysor
sorted_set: incomparable values. The reached insertion fails before the
collection changes, including through aliases. Homogeneous numeric and string
ordering is preserved. - Most runtime errors remain fatal. The existing
error()/throw/catch
model is unchanged, and ordinary runtime failures such as bad indexes and
undefined callables remain fatal. Refused reference cycles and sort-receiver
mutation are intentional catchableErrors (runtime.reference_cycleand
runtime.sort_receiver_mutated). - Import-resolution errors stop before execution. When legacy also raises
the import error, package and module resolution failures reject the program
with legacy's text and position before any statements run. An import left
unreached by a top-levelreturnis rejected by the VM even where legacy
exits without running it. - Some supported programs intentionally differ from legacy. Runtime 2.0
uses shared-reference semantics for arrays, objects, collections and structs
(arrays and objects are an intentional difference from legacy copies);
constis binding-only;reverse()andsort()return the receiver; splice
argument order and some assignment-family diagnostics are documented
differences. Reviewdocs/runtime-2/compatibility.mdbefore migrating
programs that depend on legacy copy or mutation behaviour.
The detailed compatibility contract and known limitations are in
docs/runtime-2/compatibility.md and docs/runtime-2/known-limitations.md.
Validation
Runtime 2.0 was validated on the exact release candidate across Linux, macOS,
Windows and FreeBSD 14 amd64. The release passes the Runtime 2.0 compatibility,
safety and package checks, including the 12-module package suite in VM-default,
VM-required and legacy modes. No new numerical performance claims are made in
this announcement; the website build path and template renderer are unchanged.