Ink is a minimal programming language inspired by modern JavaScript and Go, with functional style.
Ink 1.9 is a backwards-compatible update for the core language, and contains some minor non-breaking changes to the standard library APIs, mostly to improve performance.
Most notably, Ink 1.9 allows expressions in the match target position of a match clause. Previously only "atomic" expressions could be matched against in a list of choices, requiring syntax workarounds like
myValue :: {
(Type.A) -> doThing()
(Type.B) -> doThing()
(1 + 2 + 3) -> doThing()
}
These expressions may now appear naked in these places:
myValue :: {
Type.A -> doThing()
Type.B -> doThing()
1 + 2 + 3 -> doThing()
}
exit(1)
Ink 1.8 is a backwards-compatible update for the core language, and contains some minor breaking changes to the standard library APIs, mostly to improve performance.
&
, |
, ^
now support string operations. They perform bitwise operations on strings and return a new string.file.Close()
for resources needing closing in read/write/req that used to create a resource leakstr.{hasPrefix?, hasSuffix?}
that incorrectly accumulatedstd.append
, not join
, in flattening list for minimal copyingslice()
polymorphic and deprecate sliceList
There are no significant changes to language syntax or semantics in this update.
listen()
delete()
to delete filesystem nodes recursivelystat()
return valuedir()
args()
builtin for getting argv[]urand()
for cryptographically safe RNGexec()
to send event objects, not just output stringmake()
to use MkdirAll, not Mkdir (make directories recursively)asin()
and acos()
to runtimestd.writeFile
now truncates files before writing them, so writeFile
-ing a shorter file will work as expected.std.slice
now mutates one string instead of creating many, O(n) memory allocation instead of O(n^2)This release contains an accumulation of bugfixes to the standard library and some interpreter improvements since the last release. There is one breaking change, which concerns the newly introduced feature of de-duplicated imports added to load('module')
.
exec(command, []args, stdin, outputCallback)
is a new builtin function that allows Ink programs to spawn child processes in the operating system and is the primary method of communicating with other software for Ink programs. Access to this API is gated behind the --no-exec
and PermissionsConfig.Exec
flags.load()
builtin are now de-duplicated, so only one copy of the imported file is created in one running Context, on first import, which saves memory and allows for multiple files to import the same single single instance of a value.github.com/thesephist/ink/pkg/ink
as package ink
.master
branch and all pull requests.std
and str
standard library functions. In particular, more documentation is added and std.writeFile
fixes a bug related to truncating files on save.This release is mostly a minor bugfix update. Since I'll be taking a break from working on Ink for a little bit to tend to other projects. I wanted to get all the accumulated fixes out of the gate and released.
read()
now returns the correct empty value (empty string) when called with --no-read
; before, it was returning ()
.read
were calling the callback twice with conflicting data when errored. This has been fixed, so all builtins now only callback once.io.EOF
in the interactive REPL, rather than showing an error when exiting with Ctrl+D.listen()
and req()
would return ()
on empty response bodies instead of the empty string. This has been standardized around the empty string, and all exceptions to this rule have been fixed to use the empty string to represent empty bodies.samples/suite.ink
to have test descriptions for easier debugging on failing tests.This release is a major update with some breaking changes, that brings a new interface for builtin system interfaces and comes with an expanded set of standard library capabilities. You can try it at https://linus.zone/eval.
Context.Exec
io.Reader
dir()
, stat()
, and make()
builtins for filesystem operationsread()
and write()
is
operatorThis is the third preview release of Ink. The language specification has stayed unchanged, and the interpreter comes with these improvements.
listen(host, handler)
builtin function for starting HTTP servers written in Ink-repl
std.encode
faster and bug fixes to std.readFile
and std.writeFile
ink
interpreter in an Ink script's #!/usr/bin/env ink
shebang lineYou can once again go to https://linus.zone/eval to try the newest version of the interpreter, minus file read/write operations and the new listen(...)
builtin -- those are limited by the -isolate
interpreter flag.
The patch release brings a bunch of improvements to many different areas in the language and interpreter.
load()
built in function that loads other Ink programs as module objects.in()
, read()
and write()
You can also go try Ink programs on the web now, at https://linus.zone/eval
This is the first release of the Ink interpreter 🚀
echo "out('Hello, World!')" | ink
This is a preview release, because...
That said, this is a fully functional release capable of running all sample programs and tests in the project repository, and implements the full language syntax and semantics including tail recursion optimization.
This release is also designed to be free of crashes and panics. I've been hoping to set up fuzz testing using go-fuzz
but haven't had the chance yet -- so if you can make it crash, it's a bug! Please file an issue with a test case 🐞.