← back

Coming from Python

Tape's t2 profile keeps what makes Python quick to write — inference, interpolation, run the file directly. The difference is that the same source tightens into a typed program and compiles to a binary, with no interpreter to ship.

types & annotations

Python

Dynamic at runtime. def f(x: int) hints are checked by mypy and ignored by CPython.

Tape

Locals infer from the initializer — var x = 21 is an i64. Function signatures are always annotated. Switch the file to @profile(t1) and every type becomes mandatory and checked.

running & shipping

Python

python app.py needs the interpreter, the right version of it, and the packages present on every machine you deploy to.

Tape

tape run app.tape interprets while you iterate. tape build app.tape -o app writes a native executable from the same source. Nothing to install on the far end.

errors

Python

Exceptions travel up the stack invisibly. try/except is optional, so any call might raise something nobody handled.

Tape

A function declares what it can fail with: -> i64 or MathError. or return propagates it, or { } handles it inline, and defer covers what finally did.

lists & dicts

Python

list and dict are built in, hold anything, and box every element.

Tape

collections.gen_vec(T) and gen_map(K, V) run at compile time and emit a vector or hash map specialized to your types — real storage, no boxing, and the generated code is ordinary tape you can read.

what stays the same

  • - Locals infer their type — var x = 21 needs no annotation
  • - String interpolation — "Hello, {name}!"
  • - for (item in things) over ranges, slices, or anything with a .next() method
  • - Real modules and imports — no headers, no include order
  • - Run a file directly while you are still working it out