Names
These words are keywords and cannot be names: func, return, if,
else, then, while, for, in, match, when, do, end,
break, continue, true, false, null, and, or, not,
struct, enum, interface, import, as, pub, const, shared, let,
defer, async, await, extern, and the reserved delete, try,
catch, and throw. to and downto, in a for loop and a range of a
when, and with, at the start of a statement, are keywords only there,
and names everywhere else: a variable to, a field with. After a dot any
word is a name, a keyword's too, as in values.map(f). The built-in
types int, i8, i16, i32, i64, uint, u8, u16, u32, u64, float, f32, f64, str, char,
bool, void, and map, and the types of C signatures,
c_char and the other c_ numbers, cstr, wstr, ptr, Handle,
c_func, and c_array, cannot be names either.
A function, a constant, or a variable may have the name of a built-in or
of a function of the prelude. In the module that declares it, and in the
modules that import it, the name is the program's own, as an inner name
hides an outer one; everywhere else, the prelude and the standard library
among them, it is still the built-in's, and values.push(x) is always the
built-in. A variable that holds a function hides a built-in of its name
too. Types, and the prelude's types Option, Result, Error, and
Task, cannot take those names. The built-ins are print, eprint, len, push,
pop, insert, remove_at, reverse, slice, join, to_str, find,
split, replace, trim, starts_with, ends_with, upper, lower,
ord, chr, parse_int, parse_float, keys, values, get, remove,
args, read_text, try_read_text, write_text, exit, run,
start_process, poll_process, wait_process, make_dir, list_dir,
exists, is_dir, delete_file, rename_file, current_dir,
change_dir, temp_dir, temp_file, embed, write, ewrite,
read_line, read_input, read_key, key_ready, raw_mode,
is_terminal, is_input_terminal, terminal_width, terminal_height,
env, set_env, unset_env, sleep, clock_ms, unix_time, random,
random_seed, write_on_exit, panic, hash, clone, platform, arch, build_version,
build_commit, build_time, build_optimized, sqrt, sin, cos, tan,
asin, acos, atan, atan2, exp, log, log10, log2, floor,
ceil, round, trunc, abs, min, max, is_nan, and is_inf.
The prelude declares Option, Result, Error, Equal,
Ordered, Hash, ToText, map, filter, reduce, any, all,
count, sort, and sort_by for every program, so these names cannot be
declared again either.
A struct or enum name cannot be used for a variable, a parameter, or a
function, and a name given to an import with as cannot be used for a
variable or parameter in that file.