Repository navigation
Releases
Releases · R0DR160HM/hive-lang
v0.5.2
Language
- A
mutargument is lent, not copied, to a callee that can keep none of it — nomutparameter, no thread, no function in its answer — and the answer is copied instead where it could hold that storage and weighs less.
Tooling
hive testruns multiple tests in parallel (or concurrently if you set N higher than your available core count). By default, it uses as many threads as your machine has cores, but you can change the number with--threads N.- Large programs compile significantly faster: the compiler builds itself in seconds rather than minutes.
- The compiler's passes stopped deep-copying the whole symbol table at every lookup, through the lent arguments above.
indexOfoverStrandIntvectors compares directly instead of through reflection, in every program.- A program with no
with compilercall skips working out the order such calls run in. - Types and callables are looked up by name in an index rather than a scan.
- Walking the storage a type reaches stops at a shape it has already been through.
- A build asks
go envonce instead of up to four times.
hive analyzereports the copies the compiler really makes, in seconds rather than minutes on large programs: it names an answer copied in place of its arguments, no longer charges aResultfor a copy that never happens, and counts the copy of amutname bound twice in one body.
Breaking
| was | is |
|---|---|
| two tests in one program writing the same file | a file of each test's own, or hive test --threads 1 |
| a test relying on the node another one listens on, or a service name it registers | one test doing both, or hive test --threads 1 |
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.5.2
asset: hivec-linux-amd64
sha256: 062edba8e0a56100a76d3638eeb7e238c7ed16ef5ed5aa6fc2b07ffcfab23d8c
v0.5.1
Language
f(x) with compilerruns a call while the program builds and builds its answer into the executable, so reading it costs nothing at run time. Only the entrypoint may write one, its arguments are literals or other such calls' answers, and a panic in it is a compile error at the call.trim(str)is a builtin, answering with the string less the white space at both ends.
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.5.1
asset: hivec-linux-amd64
sha256: e987e5b2635ea284906b64f21615769a657cecf29fde6de6c5b50ea9bf0f6889
v0.5.0
Language
- Binary values and patterns are written
<<<...>>>, so<<and>>are only ever shifts and a shift inside one needs no parentheses:<<<x >> 4, y>>>. map,filterandfilterMaptake aprocas readily as afunc, as long as it does not take its elementmut.hive.map.setandhive.map.deleteare declared as theprocs they are, taking their mapmut.- A
-that opens a line starts a new statement outside brackets, as(and[already did; to break a subtraction there, end the line with the-. - A
T[dyn]parameter takes only a vector declared[dyn],mutor not;T[]is the parameter for any length, and the library's and Go functions' vector parameters areT[].
Tooling
- Releases are signed:
SHA256SUMScomes withSHA256SUMS.sig, andhive useand the Windows installer refuse a release whose signature does not check. GitHub attests to every file, forgh attestation verify.
Breaking
| was | is |
|---|---|
<<a, b: UInt16>> |
<<<a, b: UInt16>>> |
x is <<v: UInt4, ...rest>> |
x is <<<v: UInt4, ...rest>>> |
a line opening with - to continue a subtraction |
end the line above with the - |
a static vector or a literal passed to a T[dyn] parameter |
the parameter is T[], or the vector is declared [dyn] |
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.5.0
asset: hivec-linux-amd64
sha256: b782e35fdc73564209a638e2427a8ea0ca62d13348b1d6176c23d2374424f7c5
v0.4.3
Laws
- A law follows
hive.*calls, builtins and queries, and never runs them: a call that answers the same for the same arguments is worked out on known ones and one unknown otherwise, and any other answers whatever its type allows. async, the await-all andwith timeoutare followed: a call run alongside is the call, and a wait with a timeout is both outcomes.- A law follows a
hive.map.Mapwrite by write, sogetafter asetof the same key is what was set, and a type's law about a map field is kept bysetanddelete. - An interpolation of something unknown is a string a law can still reason about, rather than a law that cannot be followed.
hive.map
hive.map.plusandhive.map.minusaresetanddeleteanswering a new map, leaving the one they were handed as it was.
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.4.3
asset: hivec-linux-amd64
sha256: ffc1a9354dc60fc85cce077c29cfb074dc36ce9339dc4889e15e7da250985c0a
v0.4.2
Fixes
- A
[or(that opens a line starts a new statement, so[a, b] := …underx := "…"is no longer read as an index into the string. - A law on known values follows a recursion to its end, and one the prover gives up on is reported as unproved rather than as a counterexample.
x / kandx % kby a positive literal are tied back tox, son % 2 == 1shows0 <= n / 2 < n.indexOfpast the elements a law knows is one unknownResult, the same for the same vector and value, instead of a law that cannot be followed.- A guard on a call is what a type law asking the same call is told, so
if unique(pages) { Update(pages) }keeps a law assertingunique(u.pages).
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.4.2
asset: hivec-linux-amd64
sha256: 507af66e642fe4d26666bcc95e47ee0f5668858011a98079f1f3d96c2a40be53
v0.4.1
Fixes
- A
!=between integers is two cases to the prover, below and above:n != 0besiden >= 0showsn > 0, andlen(v) != 0showslen(v) > 0. A type law needing0 < len(items)was refused afterif len(items) == 0 { panic … }, with0 != len(items)among what was known. - A law follows
indexOfthrough the elements a vector is known to hold, splitting the case at each one that may be the one sought. It needed every element and the one sought known, soindexOf([], ip)was refused for an unknownip, and so wasindexOf(allowed, "*")underallowed is ["*", ..._].
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.4.1
asset: hivec-linux-amd64
sha256: c5cd6d80287331245d52015cc0bf73028042094af0182a1768a1f7a1b7dfc664
v0.4.0
Laws
lawdeclares a claim the compiler proves for every value of its parameters, and one it cannot prove is a compile error.- A false law is refused with a counterexample, and one nothing settles with the goal left open, the case it is in and what was known.
- A law cites another by calling it, and is an induction by calling itself on a part a pattern took apart; the compiler tries an induction on each vector parameter on its own.
- A generic law is proved at every set of types the program uses what it calls at, each copy on its own.
- A law reaches only code that ends and answers the same every time: no library call, no
async, no loop butfor eachand a counting loop the bounds pass trusts. - A law inside a type is kept by every value of it: each construction and each write is proved to keep it, from what that function knows there.
- A type's laws are known wherever a value of it is read, by function laws and by the bounds pass.
- A decoder refuses a value that breaks its type's law as
Broken, besideMismatchfor a document of the wrong shape. hive indentkeeps an empty line around a type's law, which touches only other laws.- A law
for table <name>is a SQL filter every query on the table carries, read off the query's SQL: in what it reads, changes and deletes, wherever the law'sifholds. - A row a query inserts or updates has to land inside a table law's filter, by writing one of its
column = valueparts. tableis a keyword only after a law'sfor, so a name spelledtablestill compiles.lawis a keyword, so a name spelledlawno longer compiles.axiomis reserved: any use of it is a compile error, so a later version can give it a meaning without breaking a name.
Fixes
- An assignment never lets a write through one name reach another:
rec.f = xscopies an immutablexs, as a binding does.
Breaking
| was | is |
|---|---|
a variable/parameter/field named law |
something else |
a variable/parameter/field named axiom |
something else |
hive.json.JsonError, hive.crypto.JwtError, hive.net.QueryParamsError and hive.term.FlagError as structs |
unions of Mismatch and Broken, sharing path, expected and found |
hive.sql.raw(connection, text) |
hive.sql.unsafe(connection, text), which no table law reads |
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.4.0
asset: hivec-linux-amd64
sha256: db824fdcce0b9c16ce7dc9a37015d5019c43204b7164e7d6f75813ef1f21bb04
v0.3.9
Tooling
hive install <entrypoint.hive>builds a program and puts it where a shell finds commands:~/.local/binon Linux and macOS, and on Windows%LOCALAPPDATA%\Programs\Hive\bin, put on the user'sPATHthe first time.--nameinstalls it under another name.hive install --desktopadds a windowed program to the system's app launcher, with its icon, on Linux, macOS and Windows.hive install --target android/arm64installs the program as an app on a phone connected over USB, throughadb.
The terminal
hive.term.printends no line, andhive.term.printlnis the one that does, so a prompt or an escape sequence is written as it is.- A terminal is read a key at a time:
rawstops the echo and the line buffering,readKeyanswers each key named ashive.uinames it and a paste as one, andsizemeasures the window. - Raw mode is put back however a program ends:
mainreturning, a panic,hive.term.exit, or its last window closing. - A Windows console paints the escape sequences a program prints, as every other terminal does.
hive.term.startruns a program alongside this one: its output read while it runs, its input written, andprocessKillstopping it with everything it started; whatever is left is stopped when this program ends.
Command-line flags
hive.term.flags()is the program's arguments as one linehive.term.codec()reads back word for word, a word holding a space or a quote quoted again;join(hive.term.args(), " ")split such a word in two.- A flag takes a short name:
-- Flag as background-task bg;reads-bgas well as--background-task, the shorter of the two names being the short one. hive.term.positional(line)answers with a command line's own words: those before the first flag, and everything after a lone--.- The flag codec pairs words knowing the type: a
Booltakes the next word only when it istrueorfalse, and a negative number is a value, never a flag.
Files, pictures and HTTP
hive.net.httpOpenreads a response as it arrives: it answers once the headers are in,httpReceiveLineandhttpReceivehand the body over piece by piece, andhttpClosedrops the connection, which is what stops a model generating.hive.imagereads PNG, JPEG, GIF and WebP pictures into their pixels, andscaleresizes one.hive.filesays where the program is:workingDirectory,home,executable, andisDirbesideexists.hive.file.assetreads the program's ownassets/folder out of its executable, which is built in whenever a program reads it, window or none.
Windows and pages
hive.uilays out grids and stacks:gridwithcolumnsandspan,stackwithplace, a row thatwraps, andminWidth,maxWidth,minHeight,maxHeightandaspecton any box.- Text takes a weight, a slant and a length:
weight,italic,mono,linesending in an ellipsis,justifyacross a text's lines, andparagraphfor words in several styles wrapped as one. radio,choices,tabs,treeandprogressare widgets, the first four heard throughonChoose,onandonToggle.- Any widget hears the pointer and the focus:
onEnter,onLeave,onPress,onPoint,onRelease,onWheel,onFocus,onBlur,onScrollandonSize;carryandonDropdrag one onto another, andonFilehears a file chosen or dropped. - A box looks more ways:
gradient,opacity,shadow,easeto bring a change in over time, andfitfor a picture. limitssets a slider's or a number's range and step, andInputKindaddsTime,DateTime,Email,Tel,Url,ColorandFile.Iconhas 320, drawn from Lucide alike on a page and in a window.- A canvas draws more:
oval,arc,wedge,curve,cutout,symbol,picture, anedge, adashand agradient, andmeasuresays how widewordswill be everywhere.
Scenes
- A scene has more shapes:
torus,capsule,disc,mesh,tube,extrude,lathe,cloud,model,sign,group, and alinewiththick. - A shape says how it shines:
rough,metal,glow,unlit,wire,shadows, and atextureandreliefof its own laid bytile;scalesizes every shape. - A scene's light is the program's:
lamp,spot,sunlight,ambient, apanorama, and abackgroundwith no alpha to see through. - The camera can
orbit, looktowarda place,roll, goorthoand set itsdepth. - A scene says what is under the pointer through
onHitandonOver, and hands over a PNG of itself throughsnapshotandonSnapshot. - A
modelorfigureplays its file's animations withplay(clip, at, loop), and a glTF without a skin, or with many meshes, is drawn whole.
Fixes
onDragreaches a scene on a page, where the picture drawn over the scene took the press.- Writing an element inside a branch or a loop keeps what was proved about its vector:
t[k] = 1in an innerifcost the outert bounds k, which a write cannot change. - A proof is lost when what it was about is replaced: an
indexOfover a vector since rebound, and a guard ongrid[0]aftergrid[0] = [1], still proved an index that could be out of range.
Breaking
| was | is |
|---|---|
| an index proved for a vector, or for a row, used after the vector or a row of it is written | guarded again after the write: writing grid[1] costs the proofs about every row of grid |
hive.term.print(text) ending its line |
hive.term.println(text) |
--verbose file.txt, an error about file.txt |
file.txt is a word, and words go before the flags or after -- |
| a flag the type does not declare, or a word between the flags, passed over | a FlagError |
a value opening with a dash, --name -x |
--name=-x, or quoted |
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.3.9
asset: hivec-linux-amd64
sha256: 6c18e273040c5ec34de1f1cd07e3131396b9969e4bb0a829ec1e2fadfb0b0ce2
v0.3.8
Standard library
hive.net.httpWsServe(port, handler, wsHandler)serves HTTP and WebSockets on one port: every request reacheshandleras underhttpServe, and answering 101 hands that one towsHandler, which takes it as underwsServe.- A
hive.net.WsConnectionsays who is at the far end:conn.addressis itshost:port, andhive.net.WsConnection(address)builds one with no socket behind it, for a test. hive.sql.runprepares a statement once and runs that one from then on, where the database parsed its text again on every call — about half of what a short SQLite statement cost.hive.sql.rawis not prepared.
Fixes
- A
querywith a row type can be run from atest: its row mapper was written only where the program itself ran the query, and a test that ran one nothing else did failed in Go withundefined: sqlFields_…. - A hole's name may open with
_, as any binding's may:"{_before is (\s*)}"was refused.
Tooling
hive containerreads the porthttpWsServeserves, as it does the other servers'.
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.3.8
asset: hivec-linux-amd64
sha256: 67e0ec41d20189256f8b25900bb0d56d0861b19831f7a5a29b519d90039236cf
v0.3.7
Tooling
hive lspis a language server: errors as a file is typed, hover, go to definition, completion, an outline, and reindenting.- LSP.md sets it up in Neovim and VS Code, the second through the extension in
editors/vscode. hive agentssends a coding agent to the language server: a page on what to ask it, and a Claude Code plugin in.hivedocs/pluginthat starts it.- A name that is no value is refused where a value was wanted:
hive.env.nope, a module or a type on its own, and a variant nobody declared passedhive checkand failed in Go. - An error inside a string's
{...}is reported at the expression, where it was at the string. - An error is reported on the line it is on, from every pass: an index at the index, an argument at the argument, a field at the field — where it was the line of the declaration around it.
hive checkwrites no Go: it stops after the checks and the bounds pass.hive analyzeno longer scores a program that does not compile: five rejections that were the emitter's alone are the checker's.- The runtime is Go under
runtime/, with its comments, and./bootstrapputs it in the compiler; it was strings in the compiler's source. - A module of the standard library is declared once, in a stub beside its Go —
term.hivebesideterm.go— where it was three tables in the compiler. - A call added to the library and used by the compiler is one build:
./bootstraphas the compiler read the checkout'sruntime/, whichHIVE_RUNTIMEnames. scene/builddownloads the engine of the latest release where that was built from the samescene/, and--forcecompiles regardless.
To bootstrap from this release, seed/pinned.txt becomes:
tag: v0.3.7
asset: hivec-linux-amd64
sha256: 4a835eeefed3b29533c15fda136eccfa602644332c8fe37a1de5ca6a931cb51e