Repository navigation
v0.15.0
Install or upgrade:
curl -fsSL https://x2c-lang.dev/install.sh | shReleases ship for macOS arm64 and x86_64 and Linux aarch64 and x86_64, with
the book as a PDF beside the archives. Read
Upgrading from 0.14.0
before replacing an existing prefix.
Language
metafunctions run ordinary x2c during translation. A macro body calls
one with$helper(...), passes constants or captured syntax, and inserts
the code it returns.meta.xsupplies theCodeandTypeoperations
for inspecting and building code. See
Meta Functions and
Generating Code.- Macro values: a macro can select, apply, and collect cases as values,
and typed quotations with expression holes build code with its type. Stmtmacros accept an expression body, and a macro call may begin with
a dotted name.- Module blocks split one translation unit across a directory. The new
modulestorage class is visible in every member file;staticstays
private to its file. - Indentation syntax: a
.xpfile, or#pragma indentin a.xfile,
groups statements by indentation without braces or semicolons. See
Indentation Syntax. raiseis a statement head,catchaccepts patterns as codes, and a
variable may supply araisecode.- Optional reference parameters, GNU statement expressions,
threaded
thread-local storage, and the contextualinmembership operator. classtypes gainallocand a refusinginit, andinittakes
constructor arguments.- Twelve language features moved out of the compiler kernel into
components undersrc/components/; their behavior is unchanged.
Library
lib/regex.xadds regular expressions over the bytes of a String, and
everyx2c scriptcan use them.lib/diff.xcomputes line differences between two texts.- The runtime's canonical pool operations moved from
ListtoPool. Var.truthreplacesVar.truthy;List.reduce,Array.reduce, and
Iter.reduceare removed in favor ofIter.foldl.- Compile-time Lisp gains tail calls and a bounded call depth.
Commands and packages
x2c newcreates a starter project that builds and runs.x2c replis a shipped command with line editing, grammar-aware and
semantic completion, and named inspection of session values. It
evaluates a supported subset of the language. See
Experimental REPL.- Package management, the editor adapter, and project creation are
external commands underlibexec/x2c/.x2c lintandx2c graphare
shipped as experimental. - Packages record native arguments in
<name>.native.rspinstead of
<name>.link. Rebuild source packages and replace native bundles. - Automatic differentiation moved from the runtime to the optional
autodiffpackage;import "autodiff"supplies its types and macros. - The SQLite package renames
StatementtoPreparedand
Var.statementtoVar.prepared. - Every package manages its handles with
$auto, so connections, loops,
images, documents, and terminals release at scope exit. - The C* verification package is removed.
Documentation
- The book adds the x2c Syntax Map for C
readers, the syntax specifications with a source
grammar and lexical rules, The Region Model, and
chapters for meta functions, generating code, the REPL, and indentation. - The language reference was corrected against the implementation and
its repeated rules removed. - The public site at x2c-lang.dev carries the
book under/docs/.
Fixed defects
- A
returninside adeferorfinallybody leaves its exception frame
before transferring, so a laterraisein the caller is caught. - Macro bindings retained across package builds, nested empty unit
macros, quotation members and splices, and template members in
anonymous aggregates expand correctly. - Parameter redeclaration inside callable bodies and the author-binding
externregression are fixed. - Constructed raw string segments, nested string literals inside list
literals, and negative percent literals in every radix are read as
written. - Pointer arithmetic over pointer typedefs and casts to template typedefs
type correctly. - Project meta payloads, include handling, the failure cache, and host
flags are repaired for package builds.
Source 3149948; candidate candidate-314994819f7fad4f4d97c6df9cf622aa7edec575-38995554323-1.