Repository navigation
Releases
v0.8.0
HQL starts child processes
(HQL-0064), is a script language
(HQL-0062), and reads a vault and its
documents as HyperMarkDown 0.1.0 states them.
Breaking
Each of these is stated in full under Changed.
- A
.hmd/config.tomlthat setswikiis refused. Rename the key to
location_path. - A plain
hqlfence is a code listing. Mark a cellhql#eval, or
hql#queryfor a cell that writes no output. - An option of
hqlwritten after the program is the program's
argument. Write it before the program:hql --to json '<program>'. - A result that is
err(e)exits1. Handle theerr, withmatchor
unwrap_or, where it is not a failure. Path.joinkeeps an absolute segment.base.join("/tmp")is/tmp.
Pass a relative segment to stay underbase.
Added
- A program may open with a
#!line. A source whose first two bytes
are#!skips its first line, so an executable file that starts with
#!/usr/bin/env hqlruns as./todo.hql. The line still counts as line
1 in diagnostics.#!anywhere else is a syntax error. hql FILEruns a file. A first free word that ends in.hql, or
contains/and names a regular file, ishql run FILE. Any other word
is a program, as before, sohql '10 / 2'andhql birdsstill
evaluate. A command name wins over a file of that name.hql -c '<program>'ishql eval '<program>', as-cis in Python
and Bash.hqlwith no program runs standard input when it is not a terminal,
echo '1 + 1' | hql, and opens the REPL when it is.- Positional arguments,
io.env.argv(). The words after a program
file or an inline program are the program's own, in order, as a
Seq<String>:./todo.hql readinggives["reading"]. They are always
granted. The program's own path is not among them. examples/scripts/:todo.hqlandlsx.hql, executable scripts. The
book's I/O chapter has a page on scripts, with how their relative paths
differ from Python, Node and Bash, and a page on child processes.- Child processes (HQL-0064).
command(program, args)ofio.processnames a program and starts
nothing.sourceandtapstart it and read its standard output,
targetandsinkwrite its standard input, andrunwaits for it and
givesok(Output)orerr(CommandFailure)with areason:not-found,
not-permitted,exited,signalled,timed-outorinvalid-text.
targetandsinkstop withclosedwhen the child stops reading. No
shell reads the command line. - A child runs in a process group of its own on Unix and in a Job Object
on Windows. When it is terminated, at itstimeout_msor when a stream
of its output is not read to its end, the processes it started end with
it.SIGINT,SIGTERMorSIGHUPtohqlends its children first,
and thenhqlby the same signal. - A project's
.hql/config.tomllists the programs a run may start with
commands = [...], and[command_output] invalid_utf8 = "replace"turns
a child's text that is not UTF-8 into U+FFFD; it fails by default. A
child inherits the variables theenvgrant gives the program. - The crate
hql-sysholds the operating-system calls that needunsafe.
hqldepends on it and it is published withhql. - A diagnostic carries its causes.
causesholds the failures below
the onemessagestates, nearest first, and the text report writes each
as= caused by:. A child's failure gives the last lines of its standard
error as its cause, and an HTTP request that does not connect gives the
errors of the connection:connection failed, caused byConnect error,
caused byConnection refused.
Changed
- A vault's cards start where
location_pathsays, the name HyperMarkDown
0.1 gives the settingwikihad. It defaults to., the vault root, where
wikidefaulted todoc/wiki. A.hmd/config.tomlthat still setswiki
is refused with a message naminglocation_path, and the vault is not read
until the key is renamed. The message for a missing cards location names
location_path. - A result that is
err(e)exits1. It is still written on standard
output. Only the result itself is tested:[ok(1), err("x")]exits0.
./check.hql && ./publish.hqlnow stops on a failed check. - Every word after the program is the program's. An option of
hql
written after the program is now one of the program's arguments, so it
moves before the program:hql --to json 'source(stdin, Json)', not
hql 'source(stdin, Json)' --to json. Path.joinkeeps an absolute segment.base.join(segment)is
segmentwhensegmenthas a root (/,C:/or a share), so
fs.working_dir().join(p)names the folder a user typed, relative or
absolute. It wasbase//segment.- A collection of strings presented as text is one string per line.
hql --to text -c '["a", "b"]'writesaandbon two lines, and an
empty collection writes nothing.format(Text)writes the same.
--to hql, the default, still writes the literal. hqlwith no word and standard input not a terminal no longer prints the
help and exits2.- A plain
hqlfence is a code listing. In a document only a fence
markedhql#evalorhql#queryis a cell.hql renderandhql check
leave a plain```hqlfence as written: it does not run and gets no
output, and anid=on it names nothing. A document whose cells are
fenced plainhqlmarks themhql#evalinstead. hql#queryishql#eval hidden. A query cell runs so that other
cells can read its value, and writes no output in any--emitmode.
Fixed
- A package built against other dependency layouts is rebuilt. An
installed build records the sizes of the types it exchanges withhql.
A build of a[packages] pathscrate whose sizes differ from this
hql's is stale and is built again on first use, where it failed to
load untilhql package rebuild.
v0.7.2
Added
- A Windows binary. The release carries
hql.exefor
x86_64-pc-windows-msvc, in a.tar.gzlike the other targets, and every
change is built and tested on Windows beside Linux and macOS. - The crate builds for a browser
(HQL-0061). Everything that needs a
socket, a process, a dynamic library or a terminal is behind one default
cargo feature,native: the server endpoints, HTTP, package loading and
the command line. Without it the crate is the language, its standard
modules and SQLite, and builds forwasm32-unknown-unknown.
cargo install hqland a plaincargo buildare unchanged. - Without
native, a program that names a server endpoint still checks, and
a read or a write on it fails saying the build has no such endpoint. hql::playgroundruns a program for a page: its source in, and what
hql evalorhql checkwould print out, with a vault held in memory.- The website has a Playground page, and a Run button on each program of
its front page. They runhqlin the browser.
Fixed
- On Windows, a path a program reads is written with
/. A card'spath
was joined with\, so
cards | filter(c => c.path | starts_with("books/"))kept no card.
fs.source_dir(),fs.working_dir()andvault.rootare read the same
way,C:/Users/ada/notes, soname,parent,stemandextensionfind
their segments. A path a message names is still written as the host
writes it (HQL-0063). - A drive root and a share are roots of a
Path, on every host:
Path("C:/Users").parent()issome(Path("C:/"))where it was
some(Path("C:")), and the parent ofC:/and of//server/shareis
none.
v0.7.1
Changed
- One import mechanism for every module
(HQL-0060).import mbinds the
module's name only: its functions are calledm.f(x)andx | m.f, its
receiversx.f(), and its types' constructors by their type's name. A
program that called a non-prelude module's function bare afterimport m,
import statsthenmean(xs), no longer checks; the error names both
fixes,stats.mean(…)andfrom stats import mean. The same rules hold for
a standard module, a package's and a project module. - The prelude is an ordinary list of import statements,
import mand
from m import *for each of its modules.coreandcollectionsare in
it like the rest, soprelude = falsewithholds them too. - An entry of
[modules] importand--importis an import statement: a
module's name isimport m, and an entry may be a wholefromstatement. - The guide on the site is the HQL book, under
book/in place oflearn/,
with its worked examples inexamples/reading-club.
Added
from m import …binds names unqualified:from stats import mean, median,*,asfor another name, andexceptto leave names out,
from stats import * except (variance, stdev).- Type selectors select receivers by the type of their
self:
from club.titles import String.*,String.initials, and a group renamed
by a pattern,String.* as String.club_*. The match is exact, with no
supertype or subtype. An alias is the same function under another name. - The check error kind
invalid-import, for an alias that changes a
receiver's type and a group renamed without a pattern.
v0.7.0
Changed
-
A vault's cards start where its
wikisays
(issue 0079).
HQL reads a vault through HyperMarkdown'shypermarkdowncrate: the cards
are the documents below the namespace root,wikiin.hmd/config.toml
against the vault root, and a card's path andfile_ofare relative to it.
wikidefaults todoc/wiki, as HyperMarkdown defines it, so a vault
that keeps its cards at its root must saywiki = "."; a vault whose
cards location does not exist fails to load, naming the setting. A
directory a host names that holds no.hmd/is still read whole. -
A reference resolves as HyperMarkdown resolves it, through its
resolver: a[[name]]in a card from that card (by path, named import, the
card's folder and each above it, imported folders, then the whole vault),
and@[[name]]in a program from the namespace root. A name two cards
share no longer resolves by its stem rule: the nearer card wins, and a
search that finds two chooses neither and warns.owl.hmdbesideowl.md:
[[owl]]is the.hmdcard, and the other is namedowl.md. -
--vaultnames the vault root, the directory holding.hmd/. A
directory inside a vault that holds no.hmd/is refused, naming the vault
root above it. -
Projects and vaults are separate
(HQL-0059). A project is a
directory holding.hql/config.toml, which takes every keyhql.toml
took;hql.tomlis no longer read. A vault is a directory holding
.hmd/. Each is found by its own walk up from the program's source
directory, and the HQL home is never a project.--projectreplaces
--workspace,--vaultnames only the vault, and the named context key
workspaceisproject.[extensions] importandpreludeare
[modules] importandprelude, and--import <module>is the
command-line layer of[modules] import. A configuration file that
states a key its layer does not take fails every run. -
HyperMarkdown is the builtin package
hmd, besidestd.hmd.vault
holds the vault, andhmd.searchwithhmd.search.lexicaland
hmd.search.semanticreplaces thesearchpackage and its modules
lexicalandsemantic. A run that has a vault, found at or above the
program or named with--vault, or that importshmd, byimport hmd,
--import hmdor[modules] import, getshmd's prelude, the bindings
vault,cardsandgraph, document references@[[..]]and vault
endpoints; a run with no vault and no import ofhmdhas none of them.hql renderimportshmdinto
every cell, and reads a vault's[hql] projectfrom its
.hmd/config.toml. -
The semantic index and its
[semantics]table live in the vault's
.hmd/, not the project's configuration. The index producer is no
longercontrib/semanticsin this repository: it is HyperMarkdown's
hmd-semantics,
and the command a refusal names ishmd-semantics build. -
A package is active per run. An import of one of its modules in the
program or in a project module the program reaches activates it for
every unit of the run,hmdincluded. A project module starts with the
imports the program starts with:std's prelude, each active package's
prelude, and[modules] importwith--import. -
In the crate's API,
hql::environment::RunEnvironmentis what a program
is checked and run against: the project's configuration and an optional
hql::vault::Vault, which holds a vault's cards and nothing of a
project.check_in,run,run_on,planandstreamtake it,
hql::environment::loadreads a directory as a host does, and
EvalCx::environment()replacesEvalCx::vault(). -
A relative path resolves against the source directory of the unit naming
it, a project module's own directory included, never the working
directory.
Added
-
fs.source_dir()andfs.working_dir()inio.fs: the source directory
of the calling unit, and the directoryhqlwas started in. -
Packages (HQL-0057, issue 0078). A
package is a Cargo crate namedhql-ext-<name>whose library is an
extension: the Rust functions behind the declarations of the modules it
provides.hql package install <name>builds one the registry of
hql-extensions lists, and
install --path <dir>one on this machine, withcargoagainst the
runninghql, and installs it into the project's.hql/packages/<name>/,
or with--homeinto~/.hql/packages/<name>/, declaring it by name in
that level'sconfig.tomland pinning it in itslock.toml;
hql package installwith no name installs every declared package at its
pin.list,info,search,update,rebuild,removeand
registrymanage what is installed and what the registry offers, and
hql doctorandhql builtinsreport it. A run finds packages in
[packages] paths, then the project, then the HQL home, and refuses a
declared package that is not installed.[packages] pathsin
.hql/config.tomlnames the crate of a package under development, built
on first use. A program reaches a package's module withimport, as it
reaches a standard one, and[modules] importnames a package too. -
A package's prelude:
prelude.hqlat its module root, a list of imports
every unit of a run imports while the package is active. A prelude that
is no import list, or that imports a module that does not exist, refuses
the package. -
hql::ext, the API a package's crate implements an extension against,
withhql::extension!andhql::native!. A library is loaded through
the symbolhql_extension_v1and held to thehqlversion, the
compiler and the type sizes it was built with; one that differs is
refused withrun `hql package rebuild <name>`. -
The book's Part V, Extending HQL:
functions and declarations, packages and extensions, writing an
extension, how a library is loaded, installing packages, the registry
and publishing, and themlpackage. -
parse_date,parse_datetimeandparse_instanttake no pattern as
well:"1982-05-09".parse_date()reads the ISO text thatto_date
reads, and the same forDateTimeandInstant
(HQL-0041 part 1, issue 0076). -
[extensions] importinhql.tomlnames a builtin package as well as a
module:import = ["search"]imports every module the package provides.
Changed
hqlis built with one exact compiler, pinned inrust-toolchain.toml,
and records it: a package is built with the compiler of thehqlthat
installs it.- The binary registers one extension per builtin package,
stdand
search, each a descriptor withid,abiandprovides, in place of
one entry per Rust source module
(HQL-0057, issue 0049). Visibility is
the module's: the diagnostic for a step whose module is not imported now
reads`mean` is declared in the module `stats`: write `import stats`,
and an ambiguous call names the modules declaring it, so the population
variancebesidestats.varianceis qualifiedcollections.variance,
notcore.variance.hql builtinsgroups steps by module and names the
package beside it,collections (std 0.7.0, always available). - A vault no longer holds the documents of a vault nested inside it: a
folder below the root that carries its own.hmd/orhql.tomlis
another vault, andcardsleaves it out, the way discovery stops at the
nearest marker (issue 0077). hql referencewrites each reference page as a hyper-markdown card,
name.hmd, and a module's page as its folder note,index.hmd. A doc
string's citation is kept as the wikilink it is written as (issue 0077).- The documentation is hyper-markdown throughout: the book, the reference,
the proposals, the issues and the design notes are.hmdcards, and the
site is built from them with unchanged URLs (issue 0077).
v0.6.0
Added
- The book's Part II, Data flows:
one shop's story from files to a lakehouse, in endpoints, tables and
topics, subjects and the lakehouse, APIs and stores (as design), OLTP (the
shop's day, mistakes, replays, streams against tables, a transfer as one
transaction) and OLAP (bronze, silver and gold, grain and keys,
deduplication, windows, merge, incremental loads), with a page on logical
steps and physical plans. Checked programs are shown with what
hql checkprints; the programs that reach a server run in hql-demo. - Randomness (HQL-0041 part 4). The
modulerandom, imported withimport random, declaressample,
shuffleandchoiceover a sequence,sampleover a stream by
reservoir,random_int,random_float, a version 7uuid()and a
version 5uuid(name, namespace). A draw with aseedargument is pure;
without one it is effectful and draws from the evaluation seed, which
--seedfixes. The generator is ChaCha12 and is not for secrets. The book
teaches it in Random values. absover aDuration(HQL-0041
part 1): the prelude'smathdeclaresfn abs(self: Duration) : Duration
beside the numbers, soabs(Duration("-PT1H"))isPT1Hwith no
import time.Entry.modified? : Instantinio.fs
(HQL-0040): the time an entry was
last modified, a link's own and not its target's, absent where the
platform records none. Every listing andentryread it with the rest
of the entry.hql --versionnames the time-zone database zone names resolve against
on a second line,time-zone database: systemfor the host's, or the
release of the database compiled into the binary,2026e, bundled.- Descriptive statistics (HQL-0041
part 2). The modulestats, imported withimport stats, declares the
reductionsmean,varianceandstdev(sample,n - 1),pvariance
andpstdev(population,n), andcovarianceandcorrelationover
Pairs, and the barriersmedian,quantile(q),quantiles(n)and
mode. A statistic ofIntorFloatvalues is aFloat, ofDecimal
values aDecimal; anIntorDecimalstatistic is computed exactly
and rounded once, aDecimalroot to 100 significant digits. An
undefined statistic isnone: the mean of nothing, the sample variance
of one value, the correlation of a constant side.quantileis linear
interpolation (type 7) and takes aFloator aDecimalq;
quantilesis Python's inclusive method;modegives the least of the
most frequent values. Withstatsimported,varianceoverInts or
Floats is ambiguous with the prelude's populationvarianceand is
writtenstats.variance. - Environment variables and invocation arguments
(HQL-0041 part 5). The module
io.env, imported withimport io.envand reached asenv, declares the
effectfulvar,vars,argandargs. A program run on its own reads
every variable;env = ["NAME", "PREFIX_*"]in a workspace'shql.toml
narrows that, andhql renderreads none. An unset, a withheld and a
non-UTF-8 variable all read asnone.--arg name=value, repeatable,
passes an argument, always granted; a name outside[a-z_][a-z0-9_]*or
given twice is a usage error, exit 2, before evaluation. - The file system as data (HQL-0040).
iodeclaresPath, a place in a file system written as text and
ordered by its segments, withjoin,parent,name,stemand
extension, which read the text alone;file(p)takes aPath. The
moduleio.fs, imported withimport io.fs, declaresFolder,Glob
andEntry(path,name,kind,size?), and the effectful
entries,walk,glob,existsandentry. A listing is a held
Seq<Entry>in the order of the sorted walk the vault reads its cards in,
reports a link without following it, is granted where reading a file is,
and is bounded by[execution] max_elements.Path,Folder,Globand
Entryare built-in type names, so a program declares its own record
under another name. - Traits (HQL-0039):
trait Shape as FiguredeclaresFigure, the union of the types implementingShape,
which holds a value of any of them, matches member by member, dispatches
f.area()on the value's own type and satisfiesT : Shape. A receiver
module lists the traits its type implements,module shapes.circle for Circle : Shape, and its ownselffunctions are the implementation;
stringandseqstateIndexandSlicethis way, sostring.at(s, 1),seq.at(xs, 1)andseq.slice(xs, r)are calls. A trait written as a
type is refused, naming the bound<T : Shape>(x: T). A trait extending
Validatoris called a validator trait. - Execution contexts (HQL-0025): a
program's file anchors workspace discovery, which stops at the nearest
directory holding.hmd/(a vault) orhql.toml.--workspacenames the
workspace,--bareruns with none, andhql contextreports the mode,
the workspace, the configuration files and the module roots with their
layers. The system file (/etc/hql/config.toml,$HQL_SYSTEM_CONFIG), the
user file~/.hql/config.toml($HQL_HOME),~/.hql/modules/and
$HQL_PATHcontribute module roots, extension settings, report settings
and the backend in every mode. Named contexts,[context.<name>], are
selected by--context,$HQL_CONTEXTorcurrent-context, and
hql config current-context,get-contexts,use-contextandview
manage them. - Transactions and relational mutations, phase 1
(HQL-0051): four capabilities of a
transport inio,Transactional,Insertable,Updatableand
Deletable, each an abstract type belowTransportand independent of
the others, whichSqliteandPostgresdeclare;IsolationLevelwith
ReadCommitted,RepeatableReadandSerializable; and
configured("id"), the endpoint configured under an id as a value of its
kind's transport type, with its boundary, sosource(configured("id"))
reads whatsource("id")reads andtarget(xs, configured("id"))writes
whattarget(xs, "id")writes. - Transactions and relational mutations, phase 2
(HQL-0051):insert E rows,
update E | filter(p) | set(f)anddelete E | filter(p)change the
rows of anInsertable,UpdatableorDeletableendpoint in place,
each as one statement of the endpoint's system, committed when it ends,
with its value the number of rows changed. A clause's lambda is
translated, never run row by row: a field of the row, a literal, a value
bound outside, comparisons,and,or,not, arithmetic,contains
of a bound collection andis_noneoris_someof a field; anything
else is a check error. The rows' type is the endpoint's configured
element, or whatof_type(T), written first, names;setgives the
fields that change as a tree, each key a field of the rows.sqliteand
postgrestables take all three. A table that does not exist is not
created. oneinseq: the one element of a sequence of exactly one, and an
evaluation failure naming the count otherwise.- Transactions and relational mutations, phases 3 and 4
(HQL-0051):with transaction(attempts = 3, isolation = Serializable) tx on {accounts, transfers} { … }runs its block as one atomic unit overTransactional
endpoints of one database,sqliteorpostgres, and commits when the
block ends. Inside the block every read and write of a participant runs on
the attempt's connection, so a read sees the attempt's own writes. The
scope's value isResult<T, TransactionFailure>,Tthe block's final
value. The handle's control calls, inio.transaction, end an attempt:
tx.commit(value),tx.rollback(reason)andtx.retry(), each of type
Never, written as a statement or an arm of agiven … otherwiseor a
match. A conflict with a concurrent transaction is retried while
attemptsremain; a constraint violation, a rollback and an exhausted
retryare theerrof the result; any other failure rolls the attempt
back before it is reported. The checker refuses a nested scope, a
participant set spanning two kinds or two databases, a computed set, a
transactional endpoint in the block that is no participant, the handle
outside a control call, a statement after one, and an isolation level
the kind does not offer. - Two transaction warnings (HQL-0051),
both of kindeffect. A scope written as a statement before a program's
last one, itsResultneither bound nor the program's result, is warned:
its failure would be observed by nothing. Underattemptswritten as a
number above 1, eachtarget,sinkor log call in the block whose
endpoint is no participant is warned, naming the endpoint: it runs on
every attempt and is not rolled back. - The module
io.db.spark(HQL-0047,
HQL-0048): the transportSpark : {Network, RowTransport, Replayable, Writable, …}and its constructor
spark(table = …, url = …, url_env = …, token_env = …, order = []),
every parameter named, sosource,tapandtargetreach a lakehouse
table with no configured endpoint. Asparktable takesinsert,
updateanddelete, each one Spark SQL statement, and a transaction
scope over it holds that one table and at most one statement that
changes it, since a Delta table comm...
v0.5.2
Changed
- The error model (HQL-0045, shown in the
error-handling examples): a failure is
data or it is a diagnostic. A diagnostic names itsphase(load,
parse,check,plan,execute,render), itskind, a stable
kebab-case name, itsseverityand itsdisposition(warning,
recoverable,fatal), each set by the phase that wrote it; the severity
is no longer derived from a stage. A contract readx | Tthat fails is
anexecute error[contract-violation]carrying theViolations
validatewould give; a data failure found while executing is of the
executephase, where it was stampedtype. ADatavalue of the
wrong shape,nameread from a string, is an
execute error[shape-mismatch]. - The text form of a diagnostic is headed by its phase, severity and kind,
check error[type-mismatch]: …, where it named a stage,
type error: …. A nearest name moves out of the message onto a
= help:line, a second place in the source onto a= note:line, and
an element a step failed on onto= element:. A count of several reads
3 diagnostics: …, where it read3 reports: …. --envelope jsoncarries the run's diagnostics underdiagnostics, where
it carriedreports; each hasphaseandkindin place ofstage.- In
hql repleach line typed is its own origin,<repl:N>, counted in
what was typed: the second line's diagnostic points at<repl:2>:1, where
it pointed into the replayed session. - The library API:
Outcome.reports: Reportsis
Outcome.diagnostics: Vec<Diagnostic>, the channel's contents in order;
Diagnosticis one record, andReport,ReportsandWarningare
removed.
Added
- One diagnostic channel per run, opened before the vault loads and closed
after the last phase: every phase writes into it, in order, and a fatal
diagnostic leaves what was written before it intact. The program holds no
name for it. A host may tap it; a tap does not keep the run open. - The loader writes
load warning[skipped-document]for a document it does
not load, a header that does not parse among them, and reads the rest; a
warning does not change the exit status. --diagnostics-format jsonwrites each diagnostic to standard error as
one JSON document per line, every field that applies present.- Under
--report collect,mapsteps past an element whose function
failed and writes the diagnostic asrecoverable; the value stands
without the element and the exit status is still1. An overflow or an
I/O failure stops under both modes. - A naming-convention warning gives the conventional spelling as help:
write it `total_of`. Diagnosticis a record of the standard library: diagnostics a run
delivered with--diagnostics-format jsonread back in a later run with
source(file(p), JsonLines) | Diagnostic.DiagnosticTextis a format a program names:| format(DiagnosticText)
writesDiagnosticrecords as the report a run prints, and--to diagnostictextnames it.- A failure inside called functions carries a
callframe for each call
that reached it, outermost first, and thebindingsof the function or
lambda it failed in; one over a card's value names the card's document as
itssource. The text form shows them as= trace:,= bindings:and
= source:lines. - Under
--report collect,filterandflat_mapstep past a failing
element asmapdoes, each naming itself as the step. - A cell's diagnostics in
hql rendername the cell as their origin,
path#idorpath#index, with a= cell:line in the text form. - A document renders only in a vault.
hql renderfinds a document's vault
from the document, not the working directory, so it renders from
anywhere; a document in no vault isload failure[missing-vault], runs no
cell and exits1. A program outside any document still runs without a
vault. --vaultnames a vault: a directory holding neither.hmd/nor
hql.tomlis refused, where it was read as one.
Fixed
- A card's
pathis its place in the vault,authors/frank-herbert.hmd,
aslib/std/docdeclares it. It was the vault root joined with it, so the
same card's path depended on the working directory and on how the vault
was named. A diagnostic'ssourceand a skipped document's origin name the
same path. - Chapter 18 of the book, Errors:
failures kept as data, diagnostics and the run's channel,strictand
collect.
v0.5.1
Fixed
- The documentation site and the crate are published for this version;
0.5.0 was released on GitHub only, with neither.
v0.5.0
Changed
- A
Decimal's significand is bounded at 512 bits and its scale at 154
digits (HQL-0031). A literal outside the
bounds is a syntax error,to_decimalgives none, and arithmetic or
roundpast them is a numeric overflow, where before a large exponent or
place count exhausted memory.
Fixed
zipof a stream with a list, in either order, is aSeqtraversed one
position at a time; it failed with "needs a collection".Datanumber leaves compare transitively: an integer and a float leaf of
one value are equal, as each already was to a decimal leaf.
Added
-
Doc strings (HQL-0042, shown in the
doc-string sessions): a block of///
lines opened after an empty line documents the declarations below it, up
to the next empty line. A doc block anywhere else, one with no declaration
directly below it, or a binding or expression in a documented paragraph is
a syntax error. Every exported declaration of the standard library carries
one, and its citations of published pages,[[/learn/…]], are checked. -
hql help <name>and:help <name>inhql replprint each declaration
of a function, type, trait or module, with its module and its doc string;
a citation prints as its page's URL under the binary's version. A name
nothing declares names the nearest one, andhql helpexits1. -
:type <function>inhql replprints each declaration of the function,
the standard library's or the session's own, with its module and the
first sentence of its doc string. -
hql builtinsdescribes each step with the first sentence of its doc
string; the Rust descriptions it printed before are gone. -
The site gains a page for every function, type, trait and module of the
standard library underreference/, written from the doc strings by
hql referencewhen a release is cut
(HQL-0043). Each release's site is
published under/vX.Y.Z/, and/latest/is the newest. -
+on two strings is concatenation:StringimplementsAdd, so
"- [ ] " + titleandreduce("", +)over strings type-check. Both
operands are strings;"a" + 1is still a type error. -
hql replleaves on the bare wordsexitandquit, as it does on
:quitand Ctrl-D; they were unbound names. -
A value block as a function body (HQL-0038;
issue 0051, shown in the
function examples):{ … }written without
=is bindings followed by a final expression, which is the function's
value and has its declared result type. Anyfntakes one, a trait's
default body and animplfunction included. A block containingyield
stays an iterating block; a block that yields and ends in an expression,
one that only binds, andforin a value block are refused. -
Decimal, an exact decimal number (HQL-0031;
issue 0042, shown in the
decimal examples): a number written with a
decimal point,12.50or1.5e-3, is an arbitrary-precisionDecimal
whose scale is kept for display and whose equality and order are by value;
aFloatis written with the suffixf,0.5f,6.02e23for2f.
+,-and*are exact,/is exact where the quotient terminates and
otherwise rounded half to even to 100 significant digits, and
round(x, places)rounds half to even.DecimalisScalarand
Orderable, andmin,max,sum,product,average,absand
signtake it. AnIntbeside aDecimalwidens to one; aFloatbeside
one is a type error namingdecimal(x)andfloat(d).decimal,float,
intands.to_decimal()convert. A JSON or YAML number or a CSV cell
read as aDecimalkeeps its digits, and aDecimalis written to JSON
and YAML as a number with its scale, and to CSV and text as its digits.
A program that passes a literal with a decimal point to aFloat
parameter, or mixes one with aFloat, now writes the suffixf. -
Contract rules and defaults (HQL-0032;
issue 0043, shown in the
structural examples): aTypeContractor
DataContractbody takesrequire Pandvalidate f with Vbeside its
fields, andname: T = literaldefaults. In a rulef?reads an optional
field, applying the rule only where it is present, or tests its presence
as a condition, and=>is implication.x | Tand a decoded stream
check every rule, and a value that breaks some is an evaluation error
naming each as written. A contract's constructor,T(…), fills its
defaults and checks its rules too.warn Pis a rule whose violation
leaves the value valid, andas namenames a rule, reported as
Contract.name. A default may be a list, set orDataliteral of
literals, never a call. -
Errors as values (HQL-0033, shown in
the structural examples):
x | validate(T)reads aData, a collection or a stream asTand
gives aResult<T, Invalid>for each value instead of stopping. An
Invalidholds the value and everyViolationof it, each with its
contract, path, kind (missing,undeclared,typeorrule), rule
identity, the rule as written and a message; a value that breaks only
warnings isok.oks()anderrs()keep the successes and the
failures of a collection of results. Amissingortypeviolation
fillsexpectedwith the type the field was read as, and atypeor
undeclaredone fillsactualwith the tree the field holds;
Violation.severitydefaults to"error", so| Invalidreads a stored
Invalidback.x | Tandx | validate(T)derive their violations from
one reading, so the fail-fast diagnostic says each error's message.
oks()anderrs()take aStreamof results to aStream, one value
at a time, as they take aList,SeqorSetto its own kind. -
fork, broadcast fan-out (HQL-0037,
shown in the dataflow examples):
xs | fork { a = …, b = … }gives every branch the same input, evaluated
once, and its value is the record of the branches' results, typed
{a: A, b: B}.{ a, b } = xs | fork { … }binds the branches, and
over aStreameach branch is a stream in the upstream's order.
A producer bound once is evaluated once: atapof a file is read once
and replayed for every later traversal, as standard input and sockets
were, and a pure branch of a boundforkthat nothing reads is not run.
fork { accepted = oks(), rejected = errs() }gives both sides of a
List,SeqorStreamof results. Rejected values written with
errs() | sink(…)read back with| Invalid,nullfor an absent
expectedoractual, and repair frome.value.
xs | retry(operation, attempts = n, when = …)reinvokes a fallible
operation for each value while it fails, up toattemptsinvocations,
the last failure standing; over a stream it is a stream. HQL-0033 is
accepted, and HQL-0032's validation result and stream-routing sections
are marked superseded by it. -
Fan-in over streams (HQL-0037):
a | merge(b)interleaves two streams, one value from each in turn,
a | zip(b)pairs them by position, anda | concat(b)produces one and
then the other.mergekeeps its map form; over aList,Seq,Set
orTableit is a type error namingconcatorunion, andf = merge
with no expected function type is an ambiguous reference.
hql plannames each step's topology,fan-outorfan-in, and lists a
fork's ortee's branches beneath it. -
Validator types (HQL-0034, shown in
the structural examples): a trait may
extend others,trait Email : Validator { }, and has their functions as
its own. A trait extending the core traitValidatoris a validator type.
validate f with Vholds whereV'svalidateof the field is true, and
is a type error where the field's type does not implementV; a field
declaredf: Vis of the type implementingVand is held to it,
reported as the violationContract.f.import validatorsgives the
standard validator types,EmailandNonEmpty, the first module of
the standard library written in HQL rather than declared for an
extension; a validator implemented for several types is named in a rule. -
Table<R>(issue 0044, shown in the
constructors examples): a table is
typed by its row,[Book(…)] | TableaTable<Book>and a table of
Datamaps aTable<Data>.Tablewritten without its row is
Table<Data>, and aTable<Book>is not aTable<Film>. -
Schema boundaries in
hql.toml(HQL-0035):
a configured source maps its fields under
[sources.<id>.fields.<field>]withnameor a dottedpath,type,
position,read,writeandabsent, and keys its kind's extension
owns in a subtable named by the kind; a malformed boundary refuses the
vault. One resolver merges the format's defaults, the configuration and
an invocation's override field by field, each property keeping its
origin, and reports every boundary error at once: an undeclared or
unmapped field, a shared or missing external field, and an external type
with no decoder. A source read as a declared record is read through its
boundary: a CSV header, a nested JSONpathand a SQLite column map onto
a ...
v0.4.2
HQL output that reads back as HQL, and a build floor that holds.
Added
- An
Hqlpresentation format, with the shorthandhqland--to hql: a
value written as the literal that writes it, so the text reads back as the
same value. A string is quoted even when it stands alone.
Changed
hql evaland the REPL write an unformatted result asHql, so
hql eval '"Dune"'prints"Dune".hql runstill writes plain text, and
--to textgives a bare string anywhere.- Rust 1.95 or newer is required to build HQL. The line editor,
rustyline 19, needs it, sorust-versionis now 1.95; 0.4.1 declared 1.88
and did not build on it.
v0.4.1
A REPL that works on a terminal, and the HQL book.
Fixed
- The REPL. A terminal session edits the line and recalls earlier inputs
with the arrow keys, from a history kept in~/.hql_history. An input goes
on over several lines while a bracket is open, or while the next line opens
with|, so a multi-line literal or a pipeline written one step per line
runs as one input, typed or piped. Ctrl-C abandons the input being typed;
Ctrl-D leaves. A session keeps every declaration — a binding with a lambda in
it, an annotated binding,fn, an alias — where it used to drop some. - A record literal opening a line inside a list,
[\n {title: …}], was read
as a set. format(…, limit = n)ignored its limit over a sequence the vault produced,
such ascards | map(…).- A collection printed as text wrote its strings without quotes, so
["a, b"]read as two elements, and wrote a set in square brackets like a
list. A value now prints as the literal that writes it:["a, b"],
{1, 3, 2}. Only a string standing alone prints bare.
Added
- The HQL book.
doc/public/learn/teaches the whole language in twelve
chapters, from a first value through records and lists, SQL-style
questions, a vault of documents, graphs, retrieval, streams and formats, to
documents built from their cells. Every program in it runs against the new
tutorial vault,examples/tutorial/, andtests/tutorial.rschecks that
each writes what the book shows.