Replacements#
Booleans#
The boolean literal keywords true and false can be replaced with
affirmative and negative. They compile to basic true and false
keywords.
The SYSROOT variable#
SYSROOT or ~/ is a special thing in that it allows you to make boring
stuff look a bit less boring. In compiled Nonstraightforward code, you can find
a constant named SYSROOT declared at the very top. It looks something like
this:
const SYSROOT = {
stdout: { write: ln: console.log },
stderr: { write: ln: console.error },
get random() {
return Math.random();
},
get urandom() {
return SYSROOT.random;
},
get zero() { return 0; },
};
~/usr/bin#
~/usr/bin/variable is a convenient way to access a variable. It compiles to
a normal variable, but it looks better than a raw identifier.
~/dev#
~/dev or SYSROOT.dev, named after the virtual filesystem thing in POSIX,
is a thing containing stdout, stderr, random, urandom, and
zero.
stdout and stderr#
stdout and stderr are both objects that contain an object that looks
like { write: { ln: ... } }. The innermost object in stdout contains
console.log and stderr has console.error.
random and urandom#
These are both just getters that return the value of Math.random().
zero#
This is just a getter that returns zero.