Skip to content

Releases

Limen 0.9.0

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 04 Dec 18:27
416a77f

The compiler written in Limen runs the tools, and programs run native by default.

Breaking:

  • limen run and limen test build and run native code by default. --native is still accepted; --interp runs the old interpreter for this release only, with a note on stderr. With no C compiler, run hands the program to limen eval. test --coverage still runs interpreted.
  • limen caps lists only the program's own functions. --all adds the standard library and dependencies, and compiler-generated names are never printed.
  • kube.watch returns a kube.Watch with the status, the last resourceVersion it saw and a message, so a resume loop needs no Shared. An ERROR event inside the stream, such as a 410, ends the watch with its code.

The self-hosted compiler:

  • limen hands check, caps, build, fmt, doc, mcp, search, add and index entry to limen-compiler, the compiler written in Limen and shipped beside it as one generated C file. Each gives the same output as the OCaml one, compared on every file in the repository and the book. LIMEN_COMPILER=ocaml keeps them in limen.
  • The self-hosted compiler fetches git dependencies and keeps limen.lock.
  • A repeated limen run starts at once: the development build is kept and run where it is.

Language and library:

  • () works as a pattern: Ok(()), Some(()), ((), n).
  • Result.ok() and Result.err() give an Option.
  • The http server writes one line to stderr when a handler panics, with the method, path and panic message, and still answers 500.

Faster:

  • A function borrows the arguments it never consumes, so calls skip a retain and a release for each one. The compiler checks itself about 9% faster.
  • The self-hosted checker no longer copies its state.

Limen 0.8.16

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 03 Dec 21:32

List: pop, truncate and binary search.

  • xs.pop() takes the last item off a list in O(1), or gives None when it is empty.
  • xs.truncate(n) keeps the first n items in place. It panics on a negative n or one past the length, as Bytes.truncate does.
  • xs.binary_search(x) finds an item in a sorted list in O(log n), and xs.partition_point(p) gives the first index where p stops holding, for insertion points and searches by key.

Limen 0.8.15

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 03 Dec 20:18

Collections: a heap, a deque and a set.

  • collections is a new std module, pure. Heap is a priority queue: heap() pops the smallest first, heap_by(less) takes any order (|a, b| a > b, or a struct field), and heap_of(xs) builds one in O(n); push and pop take O(log n). Deque is a ring buffer with O(1) push_back, push_front, pop_front, pop_back and get(i). Set keeps insertion order, with add, remove, contains, union, intersect, difference and is_subset.
  • The interpreter changes a list held in a struct field in place: reading another field, assigning one, or calling a by-value method (h.is_empty()) no longer copies the list, so a loop over a struct that holds a list is linear again (128,000 pushes: 73 s before, 0.1 s now).

Limen 0.8.14

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 03 Dec 18:33

gRPC streaming, and a gRPC server.

  • grpc streams both ways: client.open(path) gives a grpc.Stream that sends with send and close_send, reads with recv until None, and reports headers() and trailers(), which covers client, server and bidirectional streaming. open_within(clock, ms, path) sets a deadline, and running out of time is DeadlineExceeded.
  • grpc serves: a grpc.Method pairs a path with a function that gets a ServerCall to recv and send on, and grpc.unary(path, f) covers the common case. serve_conn and serve_forever answer UNIMPLEMENTED for a path no method has, and 415 for requests that aren't gRPC; a handler that panics resets its stream and the server carries on. Err(grpc.fail(code, message)) ends a call with that status. The module now needs listen as well as net and clock.
  • Messages over 4 MB (grpc.max_message()) are refused with ResourceExhausted, and compressed ones with Unimplemented.
  • http2.Exchange is the stream underneath: client.open(method, path, headers) sends a body in pieces and reads the response as it arrives.
  • Fixed: the http2 server test failed now and then on arm64, waiting too little for a flood of requests.

Limen 0.8.13

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 03 Dec 15:00

Faster startup on macOS, and Kubernetes manifests as YAML.

  • On macOS a program no longer compiles its sandbox profile at every start: the compiled profile is kept in the user's cache directory and used only when the macOS build and the profile's text match exactly, so the restrictions are the same. Startup drops by about 5 ms, and pipeline now runs as fast as the C version. Every profile denies writing to the cache and renaming the directories above it, so no sandboxed program can plant a weaker profile for another. Linux is unchanged.
  • yaml.encode of the k8s types writes the manifest a person would: None fields left out, @key names, IntOrString as 25% or 1.
  • The k8s package now takes limen-k8s v0.2.0, which adds policy/v1 and autoscaling/v2.
  • Fixed: the test suite stopped at start on inputs written with the old as "key" syntax, and the http2 server test depended on the order frames arrived in.

Limen 0.8.12

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 03 Dec 14:28

A package index by default, and the old key syntax gone.

  • limen search and limen add NAME use the hosted index at github.com/AlfonsoCampodonico/limen-index when LIMEN_INDEX is unset; LIMEN_INDEX still overrides it. Both say on stderr which index they read. The index starts with k8s, and its README says how to publish a package.
  • Breaking: field: T as "key" is an error now, with a fix that writes it field: T @key("key"). limen fmt --write still rewrites old code.
  • One script cuts a release: dev/release/release.sh VERSION builds every platform, writes SHA256SUMS, checks the macOS binary, publishes and bumps the Homebrew formula. --dry-run stops before publishing.

Limen 0.8.11

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 03 Dec 13:10

An HTTP/2 server, raw strings, and more of protobuf.

  • http2 serves as well as calls: serve_conn, serve_forever and serve_calls run each request in a task of its own, over TLS (h2) or plain TCP with prior knowledge. serve_calls reads and writes a Call as it goes, trailers included, which is what a gRPC server needs. http2.server(clock) holds the limits: idle time, one wait on the client, requests at once, body size. Malformed frames, oversized header blocks and floods of resets end the connection with GOAWAY. The module now needs listen as well as net and clock. Server push, priorities and h2c upgrade are not supported.
  • Raw strings: a string between backticks is its bytes as they are, with no escapes and no interpolation, and may span lines: `{"type":"BOOKMARK"}`. limen fmt keeps them as written.
  • protobuf: @field(n, kind) writes a number as sint, fixed, sfixed or float, and a oneof is an Option of an enum whose variants each carry one value and a number.
  • @encode and @decode work on types with type parameters: @encode fn items[T](x: Box[T]) -> List[T] converts every Box[T], and a type may hold itself through one.
  • The sandbox operator and the k8s generator moved to their own repositories, limen-sandbox-operator and limen-k8s.
  • Fixed: limen test --native and limen run --native built at a fixed name in the temporary directory, so a directory left there made the link fail. Each run now builds in a new one.

Limen 0.8.10

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 03 Dec 12:05

Field and variant attributes after the type, and kube requests that cannot touch the wrong object.

  • @key, @field and @deprecated go after a field's type or after a variant, on its line: ttl_minutes: Int @key("ttlMinutes"). Before the name still compiles; limen fmt moves them.
  • kube: create(path, manager, body) gets a 409 when the name is taken, and delete(path, uid: Some(id)) deletes only the object with that uid.
  • examples/sandbox_operator.lmn: an operator that gives out temporary namespaces with a quota.
  • Fixed: limen fmt, doc and hover gave fields that share a name the first one's key and attributes.

Limen 0.8.9

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 03 Dec 11:27

mut parameters everywhere, custom conversions, protobuf, HTTP/2 and gRPC clients, signed integers, and Bytes that change in place.

  • mut parameters work in interface methods (and so on dyn values), function types, closures and foreign functions, where mut x: T is passed as T *.
  • @encode and @decode on two pub functions give a type its own form in json, yaml, sql and protobuf. A misdeclared pair is E0129.
  • @field(n) numbers a struct field or an enum variant, and protobuf.encode and protobuf.decode read and write proto3. sint, fixed, float and oneof are not there yet.
  • HTTP/2 client: hpack, http2, and ALPN with net.offering(protocols), listen.offering(protocols) and conn.protocol().
  • grpc: a client for unary calls, with deadlines and grpc.Status. No streaming yet.
  • Int8, Int16 and Int32, with Int64 as another name for Int. json, yaml, sql and protobuf convert every fixed-size integer type.
  • Bytes in a mut place change in place: b[i] = x, push, push_all, truncate, clear, reserve, bytes_of, and fixed-size integer reads and writes at an offset. A foreign mut b: Bytes is a buffer C can fill.
  • Printing a line costs what it does in C: bench/lines takes about half the time.
  • Breaking: in a foreign block Int32 is the real Int32 type; write n.to_int32() and r.to_int().
  • Breaking: int-or-string fields in k8s are k8s.IntOrString; write k8s.Int(80) or k8s.Str("25%") where json.Int(80) was.
  • Fixed: two fields with the same name and an as "key" each crashed the checker. E0124 now also sees the key of a repeated field.
  • Fixed: in the interpreter, a pointer C hands back into a string it was lent stays valid.

Limen 0.8.8

Choose a tag to compare

@AlfonsoCampodonico AlfonsoCampodonico released this 02 Dec 23:50

Attributes, a faster scheduler, and more Kubernetes types.

  • Attributes: @ and a name before an item, a struct field or an enum variant. The set is closed and defined by the compiler: an unknown name is E0125 and names the closest known one, a misplaced attribute is E0126, a repeated one E0127, and wrong arguments E0128. There are two to start with:
    • @key("k") on a struct field gives its key in json, yaml and sql: @key("resourceVersion") resource_version: Option[Str]. The old resource_version: Option[Str] as "resourceVersion" still works, with warning W0004 and a fix that rewrites it; limen fmt rewrites it too. It goes away at 1.0. The k8s package and its generator now use @key.
    • @deprecated("msg") on a function, method, type, field or variant. A use from another file is warning W0003, "load is deprecated: use load_all", once per written use. Uses inside the declaring file are not reported, so a module can keep using what it retires.
  • limen fmt, limen doc and hover print attributes, and a doc comment above an attribute line still belongs to the item.
  • Tasks are cheaper to start and switch. Each worker's run queue is a lock-free ring, the fiber a worker readies runs next on that worker, idle workers look for work for a moment before sleeping, and a task's stack is mapped only when it first runs, with finished stacks kept for reuse. Tasks that print nothing are freed when they finish instead of when their group ends.
  • Fixed: a fiber that resumed on another thread after a wait could use the previous thread's thread-locals, because the C compiler may compute their address once per function. Runtime code now reaches them through calls that are never inlined.
  • k8s has the batch, networking, rbac and apiextensions types: Job, CronJob, Ingress, NetworkPolicy, Role, ClusterRole, their bindings and CustomResourceDefinition, with their paths.
  • unicode.same_ignoring_case is Unicode's canonical caseless match: it decomposes again after folding, so ᾠ with an acute accent matches its folded form.
  • The language server no longer crashes when you hover a name defined in another module.