Repository navigation
v0.2.10
·
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, andspawn(handler, state, name)starts one registered under an atom. Either answersResult<Address, hive.syslink.SyslinkError>—"Taken"for a name another service holds — and either takes a handler of both shapes,proc(mut S, M): Morproc(mut S, M, Address): M.at(name)is the service registered undernameon this node, andat(endpoint, name)the same one on another. Neither does any I/O.kill(address)stops a service, on this node or another.
Addressis a builtin type, written with no module;hive.Addressis the same type where a program declares anAddressof its own.- A
querymay answer with aTable: a header row of column names, then every row as text — the one resultSELECT *fills. - An
Intnever wraps. Arithmetic that would pass the largest or smallestIntstays at it —MAX + 1isMAX,MIN - 1isMIN,2 ** 100isMAX, and-MINisMAX— 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] > 0compiles, and a name a pattern binds is proved by a guard after it.
Standard library
hive.json.JsonValue.Null— a document'snull, read and written as one, where anullanywhere in aJsonValuewas an error at its path.hive.ui.window(title, view, update)is a handler, andspawnopens 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 amainthat 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]): voidpassed where aproc(Str[]): voidwas 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 timeouton avoidcall; afor eachannotation the element does not fit; a struct that holds itself by value;maintaking 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.atfailed in the Go toolchain. sortorders 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;
_ := xcompiles, and anasyncbinding nobody reads still runs. - A failed
assertsays what it asserted, and for==/!=both sides, where it said only "assertion failed". hive testshows 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, sofunc 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 areturnor apanic. A call tohive.term.exit, which never returns, now closes a path the waypanicdoes. - An error in an imported module is reported in that module's file, with names as the source spells them (
text.pad, nottext_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 namedtext-utils.hivecompiles. - Errors go to standard error, so
hive emit x.hive > main.gonever writes one into the Go; a usage error exits non-zero withhive: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
.envbeside 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 failedconnectis"Connection"; a local name nobody registered answers"NoProc"and a killed service"Down"at once, where both waited out the timeout;listenon a loopback host binds only loopback;assets/is served to any window, soassets/font.woff2sets it;hive containerexposes 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