Skip to content

Releases

v0.2.0

Choose a tag to compare

@elbayoumi elbayoumi released this 06 Dec 02:20
ce09b29

midad 0.2.0. Two things a program could not rely on are fixed, and one change breaks 0.1.x code on purpose.

  • midad run has a budget now. A program that does not serve stops after 120 seconds or 10 billion steps, whichever comes first, and the refusal names the limit and the flag that lifts it (--no-limit). A program that serves is exempt, because it is meant to keep running, and a request keeps its own 50M-step and 2-second budget.
  • Breaking: push, set_at and sort change their first argument and answer nothing, so xs = push(xs, 1) is a compile error (E0260); remove_at(l, i) answers the element it removed. The old form made a bare push(l, 1); a silent no-op. A 0.1.x program needs the assignment dropped and the statement kept.
  • null is a value of its own again, not the empty option: type_of(null) is null, is_null(null) is true, and None is the empty option. Cranelift refuses null by name for now.
  • midad new writes a project midad check . accepts; midad ast big.md | head no longer panics; midad spec prints the signature and the version the code has, including respond's third parameter.
  • The C backend compiles a typed local that takes a map value, so a group-by over a map compiles at all.

Measured here on one vCPU, medians of three, the new db workload (a group-by over 200,000 records): interpreter 269 ms, Cranelift 22 ms, C 13 ms, Rust 14 ms, Go 10 ms, Node 37 ms. midad loses to Go on this shape, and BENCHMARKS.md says so.

Known limits: a native program has neither a step budget nor a deadline, and there is no whole-heap budget. docs/LIMITS.md lists the rest.

Install: cargo install midad (crates.io has 0.2.0), or take the archive for your platform below, unpack it, and put midad on your PATH. Each archive has a .sha256 next to it.

Full notes: https://github.com/mdexec/midad/blob/main/CHANGELOG.md

midad v0.1.3-alpha.1 - early alpha

Pre-release

Choose a tag to compare

@elbayoumi elbayoumi released this 05 Dec 18:12
2765721

Early alpha. midad is a Markdown-executable language: a .md file holds routes, commands, templates and the code that runs them, and one static binary serves it. This is a pre-release for people who want to try it and report what breaks. Expect breaking changes; the language is pre-1.0 and the changes are written down in CHANGELOG.md rather than smoothed over.

What works in this build

  • Routes and a server: route:METHOD /path handler blocks, params, query, headers, body, respond/respond_html with status and headers, a static: directory for unmatched paths, 413 on an oversized body, 500 on a handler error, 503 when every worker is busy.
  • Compiled handlers: a named route handler compiles to C and is called through a request arena. Not every program compiles; what cannot be done exactly is refused by name at build time instead of miscompiled.
  • Templates: html:NAME blocks, Pug-style indentation, escaping on by default, if/for inside a template, and the same bytes on every backend.
  • Multi-file projects: imports: and module: names, midad.toml, per-file permissions that never flow into an import.
  • A capability model: fs_read, fs_write, env, net, ffi, listen, ai, db, checked statically and again at run time.
  • Checked arithmetic: + - * / % refuse to overflow in every backend.
  • Builtins added in this release: crypto.sha256, crypto.hmac_sha256, hex.encode, hex.decode, random.hex, pinned to the published test vectors (FIPS 180-4, RFC 4231) on both the interpreter and the C backend.
  • Time and JSON: time.now/time.iso/time.date/time.parse/time.add_days, json.parse/json.stringify/json.at/json_get.
  • One-document persistence: persist: writes a JSON file after every request, write-then-rename.

Numbers, with the caveat that decides them

All of these are medians from interleaved runs on one vCPU, in the same session as the comparison, with the server restarted between runs. The box's speed varies up to about 1.5x between sessions, so compare within a row, not across releases.

  • 4-key JSON route: midad 117.1 us/req, Go 129.1 (midad 1.10x faster).
  • Full route (5 keys, a concat, a two-item list): midad 175.2 us/req, Go 259.6, Node 325.4 (1.48x and 1.83x).
  • 300 KB JSON POST, server reading body.items[0].name: midad compiled 2.41 ms/req, Go 3.84, Node 1.59, midad interpreted 4.68. Node is faster than us on this route.
  • Peak RSS flat at 7.4-7.7 MB over eight rounds of 3,000 requests.
  • BENCHMARKS.md has the method and every table, including the ones where midad loses.

What is not there yet

  • No database and no user accounts. persist: is one JSON document rewritten whole after each request. A real site with a database and auth needs a driver layer and a hash/token story; docs/READINESS.md says what is missing and what each piece would cost.
  • No TLS in the server (put a proxy in front), no rate limiting, no per-request logging or request ids.
  • No package manager, no structs, no generics, no closures, no test framework in the language.
  • No fuzzing harness, and no dependency audit has been run. docs/SECURITY.md lists what is checked with the check named, and what is not checked at all. This project makes no claim of being free of vulnerabilities.
  • Multi-core throughput is unmeasured. This box has one vCPU.

Building it

cargo build --release -p midad
./target/release/midad --version
./target/release/midad run examples/site-demo

install.sh builds and installs it. No prebuilt binary is attached to this release: a binary is only worth attaching if it was built from this exact commit on a clean checkout and tested, and I could not establish that here, so the honest answer is to build it yourself rather than ship something I cannot vouch for.

Where to read more

README.md for the tour, SPEC.md for the language, docs/getting-started.md and docs/cookbook.md to write something, docs/LIMITS.md for the wall you will hit, docs/READINESS.md for what a real project still needs, BENCHMARKS.md for the numbers and their method.

v0.1.2

Choose a tag to compare

@elbayoumi elbayoumi released this 04 Dec 14:13
da50997

Native binaries now run commands, and rendering is much faster.

  • Both native backends (C and Cranelift) build command: blocks and dispatch on argv[1], matching midad run file.md <command>. An unknown command exits 2.
  • Templates render into one growable buffer on both backends. Render benchmark (200k renders, quiet 1-vCPU box, interleaved medians): C 302 -> 131 ms, Cranelift 406 -> 93 ms, Go 149 ms.
  • Templates with if/else and for render natively on both backends.
  • A native build now refuses persist: and mismatched template maps instead of silently giving a wrong result.
  • for loops in html: templates, form posts to routes, multi-line brackets, midad fmt ., run --watch, and fixes. See CHANGELOG.md for the full list.

Known limit: the C backend leaks about 160 B per render (refcounting is the next sprint's first item). See docs/LIMITS.md.

Full notes: https://github.com/mdexec/midad/blob/main/CHANGELOG.md

v0.1.1

Choose a tag to compare

@elbayoumi elbayoumi released this 04 Dec 11:11
49a4700

midad 0.1.1. Read the breaking changes before upgrading from 0.1.0.

Breaking changes

  1. / is real division. 7 / 2 is now 3.5, not 3, on every path. Integer division is idiv(a, b), which floors (idiv(-7, 2) is -4). midad check warns W008 at every / between two numbers. x /= 2 on a number variable is now a type error.
  2. Integer overflow is refused on the Cranelift backend. It used to wrap silently. It now stops with integer overflow, like the interpreter and the C backend. Tight arithmetic loops are slower for it: a 300-million-iteration add, multiply and remainder loop went from 217 ms to 327 ms, and the heavy workload by 4% (measured, see BENCHMARKS.md).
  3. Runtime errors have one format. Compiled programs print one line, midad runtime error: <message>, and exit with status 1. The C backend used mdx: <message> and status 70; Cranelift could abort with a signal. The interpreter keeps its source-located R0001 diagnostic.
  4. Mixing a number and a float stays a compile error (E0230) and now says how to convert. Exponent literals such as 1e21 stay unsupported and now say so clearly.

Also in this release

  • Functions as arguments: a parameter typed fn takes the name of a function (no closures).
  • for x in xs.
  • Clearer diagnostics for ?:, for x of, for (x in) and for i in 0..3.
  • Fixes: the interpreter, C and Cranelift now agree on overflow, string order, float text and float negation. In the C backend, chars() failed to link and unwrap_or on an error returned the wrong value. int() of a huge float crashed Cranelift binaries.

Full details are in CHANGELOG.md. Archives for Linux (x86_64, arm64) and macOS (Apple silicon, Intel) are attached by the release workflow, each with a .sha256.

v0.1.0

Choose a tag to compare

@elbayoumi elbayoumi released this 04 Dec 01:38
394cc0d

First tagged release.

midad is a Markdown file that runs. You write a program in Markdown, midad check type-checks it, and midad run executes it, or midad build --native-all compiles it to a standalone binary.

Attached: builds for Linux (glibc, x86_64 and arm64) and macOS (Apple silicon and Intel), each with a .sha256 file next to it.

What works: typed functions, option and result with ?, lists, maps, JSON, file access, HTTP routes, static files, html templates, command blocks, imports with namespaced modules, a conventional project layout that midad new scaffolds, a checker that reports 76 error codes, and three execution paths (interpreter, Cranelift, C).

Where it stops, in the repository's own words: no package manager, no collector on the native paths, and state, ai, routes, commands and FFI are refused by name rather than compiled there. docs/LIMITS.md lists the rest. BENCHMARKS.md has the measured numbers, including the ones where midad loses.

MIT.