Repository navigation
oct 12: this is very old, 0.2.0 coming in a bit, build from source for now
big release - many misc bugs are fixed but not noted
Added
-
any function is a module
fn f() do pub const x = "valx" pub const a = 123 end f() |> assert_eq({ x = "valx", a = 123 })
-
docgen documents structs, type aliases, and modules, with documented struct fields rendered under the struct entry
revo docnow outputs plaintext by default,revo doc --htmloutputs real html
--spliceflag needed to splice into piped markdown templates (was implied by--html)#!/usr/bin/env revo this is a module doc a shebang can (but doesn't have to) go up there , it also suggests this file is executable !# #* this is a struct *# struct S { #* holds a number *# x: num, } #* 2 digits of precision *# const pi = 3.14
-
stdlib:
-
exit(number) -
revo.dofile(path)-- do file & return; resole path likeimport -
csv.decode,csv.encode -
os.getenv,os.setenv -
trig functions and sign in
math -
argparse.parse,argparse.usage: docs & exampleconst result = argparse.parse(fn(p) do p:flag(:verbose, { short = "v", description = "enable verbose output" }) p:option(:output, { short = "o", description = "output file" }) p:command(:compile, { description = "compile a file" }) p:positional(:script, { description = "input script" }) end, argv) if result.err do print("error:", result.err) end else do print("flags:", result.flags) print("commands:", result.commands) print("positionals:", result.positionals) print("leftover:", result.leftover) print("") print(argparse.usage(result)) end
-
-
default arguments
# vvvvv here fn f(a = 2, ?b) do (a, b) end; hi() # => (2, :none)
-
semicolons act as boundaries
fn g() do foo = bar; (10, 11, 12) end; g() # was: tried to call bar(10, 11, 12) and assign that to foo # now: foo = bar; return (10, 11, 12)
-
unless keyword
unless :true print("this won't run") else print("this will")
-
zig extensions, examples for zig extensions (
examples/zig) -
access tuple fields via dot:
(:a, :b).0 == :a -
wider character range for atoms
:kebab-case :ok? :x>y? :name.method :a!=b :$jquery :-+*/=<>.@$~^?! -
HACKING.md -
flake.nix -
attribute syntax in the parser:
@[name]lexes as an attribute and attaches to any declaration. will be used for applying procedural macros later -
repl now connected to the same architecture as the lsp, giving you richer highlighting
Changed
- dunder methods now looked up through the normal order
table.remove(t, key)-- now works with both indices (array part) and keys (hash part)- Breaking: doc-comments are
#* ... *#now, comments attach to any declaration and are stored in types, hover follows aliases, repl:hrenders exactly what hover renders - Breaking: cli is now subcommand-based:
compile,repl,dis,bench,docs,lsp. options must come before the script name, everything after goes to runtime argv. the old flags like-band--disare gone in favor of their subcommands - Breaking: c api values use nanbox:
RevoDatais a single u64 now, boxed payloads are intern ids instead of pointers - Breaking: stdlib
read()renamed toinput(), and only reads stdin lines. usefs.open()?:read()to read files - Breaking:
fmtand string interpolation now only support%v(value, plain),%?(debug, quoted strings, multilined tables),%p(pretty, debug with colors) - Breaking:
int/float/numbernownumacross everywhere. opcodes are gone too Nativerenamed toHostthroughout the codebase- lsp: fn return type hints, nested document symbols, parameter hover and param types in hover signatures
- semantic: top-level re-declarations shadow the module surface while fn-local bindings no longer leak into it; table methods written as
fn name(self)inside a table literal get typed - ...much more
Fixed
- compiler: table literal entries declaring bindings reserved parent-frame registers mid-expression, clobbering the table under construction and desyncing enclosing call windows ("want table, got function"). declaring entries now compile in an isolated child frame, and keyless binding entries land in the array part instead of under the binding's name
orelsefalls through on:undef, sot.missing orelse 0works for absent table keys (GH-40)- diagnostics expand tabs to tab stops before rendering carets, which no longer drift left on tab-indented lines (GH-36)
- stdlib
len()signature corrected fromnumber|:niltonumber - lsp signature help deep-copies parsed types so shared comptime sentinels can't dangle
- vm: table printing now consistent for
%v%?%p; atom keys without:,=separator, multiline for debug/pretty when 2+ hash entries, pretty grouped array line, colored braces for empty - vm: string escapes
\b\f\v\0\xXXnow rendered for non-printable bytes - ...much more
new contributors
full changelog: 0.1.1...0.1.2
binaries are statically linked with musl when possible (this is why their sizes can reach >4mb). compile with
zig build -Doptimize=ReleaseSafe -Ddynamicif you need a dynamically linked binary