Repository navigation
Mimic nightly 0.4.3-nightly.20261129
Pre-releaseA nightly build of the development branch: not a stable release. Install it with mimic upgrade --nightly.
Added
- C structs in a hand-written
extern "C"block:struct pollfd { fd: i32, events: i16, revents: i16 }with the functions that use it, imported as a trusted header would be (the recordc::Pollfd, taken and given by those functions) but with only what the block declares, so the audit does not warn about trusting a whole header. Reported by a user. mimic whysays why a map stays off the GPU: on macOS, a fused map with no GPU kernel gets a note with the reason (it computes in f64, reads another list, or calls a function with no GPU version), where only the maps that went there were shown. Reported by a user.term::poll_key(ms): a key, orNonewhen none is typed withinmsmilliseconds, so a real-time program (a game's loop) reads keys without stopping. And Ctrl-C restores the terminal: in raw mode, Ctrl-C, SIGTERM or a closed terminal ended the program without restoring it (raw mode, a hidden cursor and the alternate screen stayed); the terminal is restored, the cursor shown and the normal screen brought back first (unless the program setos::on_interrupt). Both reported by a user's game.- Constants:
const width: f64 = 80.0at module level (glyph≝, digraph\c;pub consttoo), usable wherever an expression is. A list, text or record constant is worked out the first time it is used, then shared; a constant's value cannot have effects (E0606). Reported by a user's game, approved by the owner. - Typed maps
[K: V]: a map's key and value types, declared (let m: [str: i64], parameters, record fields) or worked out from a literal. A lookup has the value's type (a plain number inm[k] + 1),getgives a typedOption,keysandvaluestyped lists; a key or value of another type is refused when checking (E0401), an integer next to floats promoted as in a list. - Sized lists
[T × n](also[T * n]):[f64 × 3],[i64 × 9], a list with its length in its type, for parameters,lets, results and record fields. Up to 16 numbers are kept in registers. A written-out list of another length, or a constant index outside it, is refused when checking (E0217; a call with a list of another known length, E0401); a list of unknown length is checked where it is bound;[f64 × n]turns integers into floats. - Assignment into nested lists and records:
g[r][c] = v,s.pos.x = v,l.todos[1].done = true, and+=and the like on them, on alet mutvariable. Each level is changed in place when nothing else holds it and copied once otherwise: 4 million writes into a 2000×2000 grid take 0.7 s (a row copied each time before: 63 s), and a record's list field changed in a loop is no longer copied per step. random::at(seed, i)andrandom::at_float(seed, i): thei-th random number from a seed, with no state, so a program makes its input on every core (⍳ n ¨ (i => random::at(seed, i)): 50 million numbers in 0.16 s on a 12-core Mac) and gets the same numbers on every run.- Loops:
for,whileandbreak(∀,⟳,↯; digraphs\F,\O,\B):for i in a ‥ b { … }over a range,for x in xs { … }over a list's elements,while cond { … }, andbreakto leave the innermost loop (E0216 outside one, or inside a lambda). A loop changes its function'slet mutvariables, one step after another; parallel work stays with¨and the array primitives.settle,evolveand recursion are unchanged. Tutorial chapter 4 and the syntax reference describe them; the editors' grammars know them. - Compound assignment
+=,-=,×=and÷=(ASCII*=/=; glyphs+↩-↩×↩÷↩) on alet mutname or a list element:total += i,counts[k] += 1. An index other than a name or a number is computed once.
Changed
join(⍳ n ¨ (k => …text…), sep)makes no list of texts: each text is appended to the result as it is made and released, where a list of n texts was built and joined after; a pure function that calls the program's own functions keeps the parallel map when the program has several workers (chosen when running).translit(8 million texts) 0.83 s → 0.30 s on one core, 0.40 s → 0.28 s on all cores;aho0.58 s → 0.38 s on one core, the same on all.- Output is written before a C call that replaces the process: what a program printed just before
execl(orfork,_exit,system, …) was lost when its output went to a pipe or a file (buffered); it is flushed first now. Reported by a user. mimic test file.mimworks on a file of a project: it was refused (E0903, a library module used on its own); it builds the project and runs that file's tests only, from anywhere. Reported by a user.build.mimsettings are checked: an unknown setting, or a value of the wrong kind (opt = 7,leak_check = 1), is an error naming the nearest known setting, where a misspelt one was silently ignored. New:strict_math = truein a profile, as--strict-math(--fast-mathoverrides it). Reported by a user.MIMIC_GPUvalues are checked, and1has a floor:0/offnever uses the GPU, unset orautolets the runtime decide,1/onsends maps of 65,536 elements or more (a smaller one costs more to start than it saves),alwaysevery map (what the tests use); any other value stops the program with a message, where2,defaultor the empty text meant "always". Newos::unset_env(name). Reported by a user's game.- Functions passed to a parameter of a declared function type are typed: with
more: fn(i64) -> bool, a lambda passed asmoreworks on integers (it was typed with unknown arguments, its arithmetic the runtime's generic operators), and a callmore(x)gives abool.tokenizetwice as fast (0.87 s → 0.43 s on one core). - Searching text jumps to its first byte:
find,contains,replaceandsplitcompared the part at every position; they look for its first byte with the C library's vectorisedmemchrnow, then compare the rest.url35% faster on one core (3.27 s → 2.11 s),http_parse44% (1.21 s → 0.68 s),ini8%. - A loop's tuple state changes its list in place: in
settleandevolve, a step such as(s.0 + 1, put(s.1, k, v))copied the list each step, as the state still held it. The step owns its state now, and a field it reads once as the listput,pushorconcatchanges is taken out of it and changed in place (a start state still held elsewhere is copied as before).huffman's decoding table: no values made in the loop's steps, 0.12 s → 0.10 s. - A shared list of numbers written by index is copied in one pass:
putorxs[i] = von a list held elsewhere copied it element by element; it is one copy of the bytes now (huffman, whose decoding table of 512K numbers is written from a loop's tuple state: 0.18 s → 0.12 s on an M3 Pro). - A list a loop only reads and writes element by element is checked once, at the loop's start: a
let mutlist of numbers that afororwhilebody uses only asxs[i],xs[i] = vand≢ xsis made held once there (copied if shared, as its first write would have) and its kind and length checked; each element write in the loop is then a bounds check and a store, with no atomic read of its count.levenshteinwritten with loops 14% faster.
Install
Download the file for your system below and unpack it. Then run the install script inside: it copies mimic to ~/.mimic/bin, puts that folder on your PATH, and checks what your system needs.
| System | File | Install | Also needed |
|---|---|---|---|
| Windows x86_64 (10, 11) | mimic-0.4.3-nightly.20261129-windows-x86_64.zip |
Double-click install.cmd |
Nothing: Windows programs are linked with the MinGW-w64 inside mimic. |
| macOS Apple silicon | mimic-0.4.3-nightly.20261129-macos-arm64.tar.gz |
./install.sh |
The Xcode Command Line Tools (xcode-select --install), for the macOS SDK. |
| Linux x86_64 | mimic-0.4.3-nightly.20261129-linux-x86_64.tar.gz |
./install.sh |
glibc 2.28 or newer (Ubuntu 20.04, Debian 10, RHEL 8 or later) and a C compiler (cc) to link native programs. --target x86_64-linux needs nothing else. |
On Windows, if double-clicking install.cmd does nothing (some company PCs block scripts), open PowerShell in the unpacked folder and run:
powershell -NoProfile -ExecutionPolicy Bypass -File ".\install.ps1"The script says if something is missing and how to install it. Open a new terminal afterwards so the new PATH applies.
Upgrading from an earlier Mimic: run the new install script the same way. It replaces the old mimic, clears the build cache the old version left in ~/.mimic/cache (it is rebuilt on first use), and keeps your projects and installed libraries. If another mimic comes first on your PATH, it says where, and offers to remove it.
- macOS: the script clears the download quarantine. If you copy
mimicby hand instead, runxattr -d com.apple.quarantine mimiconce. - Windows: the script unblocks the downloaded files. SmartScreen may still ask the first time: "More info" → "Run anyway".
- Uninstall:
./install.sh --uninstall, orinstall.cmd -Uninstallon Windows. Your projects are not touched.
First program
mimic create hello
cd hello
mimic runmimic --help lists every command. SHA256SUMS has the checksum of each file.