Repository navigation
v0.2.9
Language
- A
procwith a mutex parameter is a value. It can be referenced, partially applied, stored and passed like any other: a function type marks the positionmut—proc(mut Str[dyn], Str): void— and a call through the value hands it amutvariable exactly as a direct call does. A partial application leaves a mutex position a hole, andfunc(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.spawnAddressedandhive.ui.windowAddressedstart 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 ofString,Boolean,Int,Float,ArrayandObject, 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. AnObjectholds its properties as ahive.map.Map<Str, JsonValue>in document order, sohive.map.get(properties, "name")reads one, and a key written twice keeps its place and its last value.
Performance
x = f(x)handsxover without copying it wherever nothing butf's result can keep it — no mutex parameter, no thread handed any storage, no function value in the result — nested calls included. A service'sworld = ticked(world, dt)copied its whole world every message.- A
procwith no mutex parameter is lent storage the way afuncis, 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)insideif v bounds 0leftv[0]compiling and failing at run time. - A library type the library does not have is refused, where
hive.net.Nonesuchcompiled and the Go toolchain reported it undefined. sortwith 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 thefuncthat says which of two comes first.- A
mutvalue 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