Skip to content

v0.2.9

Choose a tag to compare

@github-actions github-actions released this 28 Sep 18:15
· 135 commits to master since this release

Language

  • A proc with a mutex parameter is a value. It can be referenced, partially applied, stored and passed like any other: a function type marks the position mut — proc(mut Str[dyn], Str): void — and a call through the value hands it a mut variable exactly as a direct call does. A partial application leaves a mutex position a hole, and func(mut ...) is refused.
  • A call through a function value is held to its type: how many arguments, what each one is, and no named arguments, where only a field's argument count was checked and a local's mistakes reached the Go toolchain.

Standard library

  • A service's handler is now proc(state: mut S, msg: M): M. It writes its state in place and answers with what it returns, so every request is answered, and the handler is an ordinary proc a test can call.
  • hive.syslink.spawnAddressed and hive.ui.windowAddressed start a handler that takes its own address third, proc(mut S, M, hive.syslink.Address): M, and is handed it every turn.
  • A handler whose state is not mut, whose answer is not one of its own messages, or whose state argument does not fit is refused where it is started.
  • hive.json.JsonValue — a document whose shape is not declared: a union of String, Boolean, Int, Float, Array and Object, whose codec reads and writes the JSON as it is. It is built, matched and compared like any declared type, and may be a field of one. An Object holds its properties as a hive.map.Map<Str, JsonValue> in document order, so hive.map.get(properties, "name") reads one, and a key written twice keeps its place and its last value.

Performance

  • x = f(x) hands x over without copying it wherever nothing but f's result can keep it — no mutex parameter, no thread handed any storage, no function value in the result — nested calls included. A service's world = ticked(world, dt) copied its whole world every message.
  • A proc with no mutex parameter is lent storage the way a func is, and a send counts as starting no thread: its message is copied on the way out.

Fixes

  • A vector handed to a mutex parameter loses what was proved about its length, where shrink(v) inside if v bounds 0 left v[0] compiling and failing at run time.
  • A library type the library does not have is refused, where hive.net.Nonesuch compiled and the Go toolchain reported it undefined.
  • sort with nothing to order by is refused. A vector of maps, addresses or function values — or of a type holding one — compiled and panicked when it ran; it now asks for the func that says which of two comes first.
  • A mut value handed to a function value's ordinary parameter is copied, as a direct call copies it.

Breaking

was is
hive.json.flatten, hive.json.get, hive.json.table hive.json.JsonValue.decode(text, hive.json.codec()), then a pattern
encode of a Table, or of a type with a Table field, re-nesting [path, value] rows a compile error, Str[dyn][dyn] included
a Table field decoding as a flattened document a compile error
proc h(s: S, m: M, from: hive.syslink.Envelope): S proc h(s: mut S, m: M): M
hive.syslink.answer(from, v) return v
hive.syslink.self(from) a third parameter me: hive.syslink.Address, started with spawnAddressed or windowAddressed
hive.syslink.monitor(from, target, notice) hive.syslink.monitor(watcher, target, notice), watcher an address on this node
an answer given after the turn ended removed: a turn answers when it returns
a request left unanswered failing as NoReply removed: every request is answered

To bootstrap from this release, seed/pinned.txt becomes:

tag:    v0.2.9
asset:  hivec-linux-amd64
sha256: dfb875a1592215e0d3a7c24881acc19b9693f68a63ca09cff4d19ac23221e2e3