Thicket thicket
cambridge
REPOS 4

Projects covers Forester, Merry, xdge and ocaml-crockford.

W12.2026 · 16–22 Marprojects

Merry, a POSIX-compatible shell, now includes a return statement and function-scoped variables, making it more practical for writing shell functions. Quoting and signal-handling behavior has also been corrected in several places to match standard sh.

Features

  • Return statement: A new return built-in lets a function exit with a specific status code, matching how sh handles function returns. This makes it straightforward to signal success or failure from a function back to the calling script. Commit

  • Local variables: A new local built-in creates variables that are visible only inside the current function, reducing the chance of accidentally overwriting a variable used by the outer script. The implementation is described as a rough approximation of POSIX behavior. Commit

  • Debug logging: Basic debug logging is available through command-line options that set the log level, which can help when a script misbehaves and you need to see what Merry is doing internally. Commit

Fixes

  • Trap signal handling: trap now recognises numeric signal IDs (1, 2, 3, 6, 9, 14, 15) in addition to named signals, so scripts that reference signals by number will work as expected. Previously, only the named form was accepted. Commit

  • Argument expansion: Field-splitting and handling of positional parameters now match sh more closely for both quoted and unquoted expansions, reducing unexpected word-splitting in scripts that pass arguments through variables. Commit

  • Empty assignments: The parser now accepts assignments with no value (such as FOO=), which were previously rejected and would cause a script to fail at parse time. This brings Merry in line with sh, where clearing a variable this way is common. Commit