Two days after 0.16.0, and a bigger release than that gap suggests. You can talk to the person at the keyboard, the type checker now reaches into the packages you depend on, and a handful of things you would expect a language to have arrived at once.
#Ask the person at the keyboard
sys.readline() reads a line.
sys.readpassword() reads one without showing it. Both sit
behind a new --allow-tty grant, so a script cannot start
prompting unless you let it, the same way it cannot read a file or open
a socket unasked.
import sys
sys.write("What should I call you? ")
let name = sys.readline()
sys.write("API key: ")
let key = sys.readpassword()
That closes the last gap in the tool-shaped programs SCUA is built for: read arguments, ask what is missing, do the work, emit structured output.
#Your dependencies are type-checked now
The checker runs across everything you import, not only the file you
ran. A library's annotations, where refinements and arity
are enforced in the code that gets shared and reused, which is where
they earn their keep.
Now an imported module is checked in its own right, and its errors are reported against its file and its line rather than yours. A package author gets the checker while writing the package. You get it when you add one.
#A module can export a type
-- shapes.scua
enum Kind { Circle, Square }
-- anywhere that imports it
import shapes
match shapes.pick(0)
shapes.Kind.Circle -> print("circle")
shapes.Kind.Square -> print("square")
end
Enums cross the module boundary as real types, usable in patterns and as constructors, with exhaustiveness checked on the far side.
#The rest of it
delete(t, k)removes a table key. Assigningnilnever did: the key survivedlen, iteration andjson.encode.sys.write(s)writes without a newline, for when you are composing output rather than emitting lines.- Catchable stack overflow.
pcall/tryturn "this input nests too deeply" into an ordinary error, and a runaway recursion in one actor no longer takes the others with it. - Unique ids:
ids.uuid4,ids.uuid7andids.ulid, drawn from host entropy rather than the seeded RNG, so they are unguessable rather than merely distinct. - Full TOML 1.0, plus
toml.encodeto write it back out. --allow-fileand--allow-allso a sandboxed run is one flag instead of six, and--env-filewith a puredotenv.parse.- Faults name their own file, and so does every line of a backtrace, which matters now that your dependencies are real modules with real line numbers.
- Regex offsets are 0-based,
Ok(x) == Ok(x)compares structurally, anddatetimeorders with<.
#The JIT now runs in macOS releases
Worth knowing if you have benchmarked SCUA on a Mac. Signed macOS builds ship with the entitlement the JIT needs, so the optimising tiers are live in a downloaded release for the first time. If you measured performance from an earlier macOS download, you were measuring the interpreter.
Linux and Windows were never affected.
#One note on the package manager
scua-pkg 0.3.1 emits for scua 0.14 to 0.16, so package commands hold off until a scua-pkg release catches up with 0.17. It says so plainly rather than emitting something subtly wrong. Running programs never needs it.
The changelog has the full accounting.