Skip to content

v0.2.10

Choose a tag to compare

@github-actions github-actions released this 30 Sep 00:54
· 131 commits to master since this release

Language

  • Services are the language's own. Three builtins start, name and stop them:
    • spawn(handler, state) starts a service, and spawn(handler, state, name) starts one registered under an atom. Either answers Result<Address, hive.syslink.SyslinkError> — "Taken" for a name another service holds — and either takes a handler of both shapes, proc(mut S, M): M or proc(mut S, M, Address): M.
    • at(name) is the service registered under name on this node, and at(endpoint, name) the same one on another. Neither does any I/O.
    • kill(address) stops a service, on this node or another.
  • Address is a builtin type, written with no module; hive.Address is the same type where a program declares an Address of its own.
  • A query may answer with a Table: a header row of column names, then every row as text — the one result SELECT * fills.
  • An Int never wraps. Arithmetic that would pass the largest or smallest Int stays at it — MAX + 1 is MAX, MIN - 1 is MIN, 2 ** 100 is MAX, and -MIN is MAX — where it wrapped around to the other end. Two literals that overflow together, 9223372036854775807 + 1, compile too, where the Go toolchain refused them.
  • A guard covers the rest of its own condition: if v bounds i && v[i] > 0 compiles, and a name a pattern binds is proved by a guard after it.

Standard library

  • hive.json.JsonValue.Null — a document's null, read and written as one, where a null anywhere in a JsonValue was an error at its path.
  • hive.ui.window(title, view, update) is a handler, and spawn opens it. Opening a window no longer waits for it, so a program may open several: closing one kills its service, closing the last ends the program, and a main that returns while one is open waits for them.
  • hive.task.sleepForever() parks the calling thread for good.

Fixes

  • A builtin called from an imported module is the builtin, where the entrypoint declaring one of the same name — a test file's own at, say — captured the call.
  • A dead service's name is free before anyone hears it died, so a caller told "Down" can spawn under it straight away.
  • The bounds pass is sound where it was not. An index rebound, redeclared or shadowed by a pattern under its guard, a length lost through an assignment in a loop body, a counter moved inside its loop, and an upper bound with no lower one all compiled and could fail at run time; each now costs the proof.
  • Builtins and library calls take named arguments like any call, by the names specs 13 and 14 give them, and work them out in the order written: join(sep: ",", vector: v), hive.math.clamp(value: x, low: 0.0, high: 1.0). A builtin ignored the names and reached the Go toolchain with the arguments in the wrong places, and a library call silently took them by position.
  • A function value fills only a slot whose calls it can take. A proc(Str[3]): void passed where a proc(Str[]): void was wanted compiled, and failed out of range when the slot handed it one element; a callable with a sized parameter is otherwise a value like any other, its type carrying the promise.
  • Programs the Go toolchain refused are refused by the checker, with a message about the program: binding a call that answers with nothing; declaring a name twice in one block; an expression that is not a call standing as a statement; an operator on a type it is not defined on (< on vectors, - on strings, == on function values); an await-all mixing answer types; with timeout on a void call; a for each annotation the element does not fit; a struct that holds itself by value; main taking or answering anything; a builtin or library call as a value or partially applied; a union field only some variants have, or an assignment into a union's field; two tests with one title.
  • A union value reads its shared fields, where event.at failed in the Go toolchain.
  • sort orders a union by its variants' declaration order, where it left the vector as it was or panicked.
  • A partial application captures what it was given, where it read the variable at each call; named arguments are evaluated in the order written; _ := x compiles, and an async binding nobody reads still runs.
  • A failed assert says what it asserted, and for ==/!= both sides, where it said only "assertion failed".
  • hive test shows what a failing test printed, and only that: a line of go test's own about the runtime package no longer trails the last failure as a blank line, and a printed line keeps the tabs in it.
  • A function that answers with a value cannot end on an assert. One that holds carries on past it, so func f(n: Int): Int { ...; assert n == 0 } fell off its own end and crashed with "hive: unreachable" on exactly the input it asserted; it is now a compile error asking for a return or a panic. A call to hive.term.exit, which never returns, now closes a path the way panic does.
  • An error in an imported module is reported in that module's file, with names as the source spells them (text.pad, not text_0_pad) — from every pass, the emitter's included, and in coverage too; an import that names no file is reported at the import; a file named text-utils.hive compiles.
  • Errors go to standard error, so hive emit x.hive > main.go never writes one into the Go; a usage error exits non-zero with hive: in front; every command refuses a flag it does not take. What a running program's runtime says about itself — a service that crashed or dropped a message, a node gone down, a window that could not open — goes there too, rather than into the program's own output.
  • The runtime: a .env beside the executable is read wherever it is started from; a CSV's byte-order mark is dropped and a separator longer than one character refused; JSON keeps a repeated key's last value in both readers and refuses text after the document; a failed connect is "Connection"; a local name nobody registered answers "NoProc" and a killed service "Down" at once, where both waited out the timeout; listen on a loopback host binds only loopback; assets/ is served to any window, so assets/font.woff2 sets it; hive container exposes no port for a program that serves none, and writes no Dockerfile for a program that does not compile.

Breaking

was is
hive.syslink.spawn(h, s), hive.syslink.spawnAddressed(h, s) spawn(h, s), answering a Result
hive.syslink.register(#Name, address) spawn(h, s, #Name)
hive.syslink.at(#Name) / hive.syslink.on(endpoint, #Name) at(#Name) / at(endpoint, #Name)
hive.syslink.stop(address) kill(address)
hive.syslink.Address Address
hive.ui.window(title, view, update, state), hive.ui.windowAddressed(...) spawn(hive.ui.window(title, view, update), state)
closing a window ending the program closing the last one does
an address in a message's digest as hive.syslink.Address Address: a node built before this one does not talk to one built after
a path ending in assert end it in panic or return
hive.conv.its(_), join(_, ",") a func of your own, partially applied
proc main(args: Str[]): Int proc main(): void, with hive.term.args() and hive.term.exit(code)
x := 1 twice in one block mut x, then x = 2
#A + #B atoms do not add
Int overflow wrapping around it stops at MAX or MIN
compile errors, and the runtime's hive: notices, on standard output on standard error

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

tag:    v0.2.10
asset:  hivec-linux-amd64
sha256: 343f61743e27380bbe6f1568582863dbb50ecbfd55f8ae706236b9c46b44b7be