v0.7.0tagged release
A research project testing one idea: implicit hierarchical arenas under value
semantics. Every scope owns a memory arena, freed on exit. There is no reference
type, so the compiler can place every allocation and free from your code's structure
alone. New here? Start with the tutorial ↗
— builds with cc and make, nothing else.
v0.7.0tagged release§01 The idea
Allocation is a pointer bump. When the scope exits, the whole arena is freed in one step.
b := a copies. The compiler sees every value's lifetime from the syntax alone.
Every allocation and free is inserted for you — no GC, no manual free, nothing to annotate.
fn main():
total := ""
for i := 1; i < 6; i += 1:
total = total + str(i)
if i < 5:
total = total + ", "
println("counted: " + total) # counted: 1, 2, 3, 4, 5
Listing 01. The string built inside the loop lives in main's arena — the compiler frees it for you on return.
main's arena.§02 Why it stays fast
Where the model helps and where it costs are both measured — as machine-specific ratios, with the workloads that produce them — in the performance notes ↗. Pointer-shaped data like graphs and trees is where value semantics is least free, and the docs are honest about that.
struct Person:
name: string
age: int
fn promote(p: Person) -> Person:
q := p # a full, independent copy
q.age = p.age + 1
return q # moved into caller's arena, not copied
fn main():
ada := Person("Ada", 36)
older := promote(ada)
println(str(ada.age) + " " + str(older.age)) # 36 37
Listing 02. return moves the value into the caller's arena; the copy q := p stays independent.
§03 The language
Python/Nim-flavored syntax, Go/Odin-like semantics; the value-semantics core comes from Hylo ↗.
§04 How it's checked
It's experimental in scope, not in rigor — the honest caveats live in the performance notes ↗.
§05 Try it
# Linux x86-64; a Windows build is on the same release page
$ curl -fsSLO https://github.com/StefanVonRanda/tycho/releases/download/v0.7.0/tycho-v0.7.0-linux-x86_64.tar.gz
$ curl -fsSLO https://github.com/StefanVonRanda/tycho/releases/download/v0.7.0/tycho-v0.7.0-linux-x86_64.tar.gz.sha256
$ sha256sum -c tycho-v0.7.0-linux-x86_64.tar.gz.sha256
tycho-v0.7.0-linux-x86_64.tar.gz: OK
$ tar xzf tycho-v0.7.0-linux-x86_64.tar.gz && cd tycho-v0.7.0-linux-x86_64
$ ./tychoc examples/hello.ty && ./examples/hello
built examples/hello
what is your name: Ada
hello Ada
Listing 02b. The prebuilt route: the tarball carries tychoc, the
core library and the examples. You still need cc — it is what tychoc hands
the generated C to. Building from source below ends at the same prompt.
# a `cc` and `make`, nothing else
$ git clone https://github.com/StefanVonRanda/tycho
$ cd tycho
$ make # builds ./tychoc
$ ./tychoc examples/hello.ty && ./examples/hello
built examples/hello
what is your name: Ada
hello Ada
Listing 03. The success-criterion demo: ask for a name, greet it.