Changelog
beta-2.0.0 — a big modernization of the language, and a 6x faster interpreter:
Objects:
- Classes:
ton.class Name extends Parent { ... }with fields, aninitconstructor, methods,self,super,toString(), and typed object variables (ton.Point p = Point(1, 2)) — see Classes & objects. - The dot operator everywhere:
obj.field,obj.method(),dict.key, and uniform call syntax ("hi".upper(),arr.filter(...).map(...)) — see Method syntax.
New syntax:
- Arrow functions
x => x * 2,(a, b) => { ... }, and the pipex |> f(y). - f-strings
f"Hello {name}!", raw strings in backticks,\u{...}escapes. - Ranges
0..10/1..=10, slicesa[1:3], negative indicesa[-1]. ton.let/ton.var/ton.const, and destructurington.let [a, ...rest] = arr,ton.let {x, y: alias} = obj.for k, v in dict,for i, x in array,for c in "text", loop variables withoutton., a fresh scope per iteration.- Optional chaining
a?.b,a?.[i],f?.();??=;**(power); spread in callsf(...args). - Number literals
1_000_000,1e9,0xFF,0b1010,0o755. throwany value (dicts, objects);catch errwithout parentheses.IMPORT://module as aliasnamespaces andIMPORT://folder/module.print(a, b, c)with several arguments;print,int,float,bool,dictusable as function values.
Standard library: ~45 new functions — sum, avg, sorted, sort with a comparator, range, zip, enumerate, unique, flatten, chunk, groupBy, flatMap, count, findIndex, forEach, items, dict, merge, remove, insert, removeAt, padStart, padEnd, startsWith, endsWith, repeat, chars, lines, capitalize, int, float, fixed, isinstance, copy, deepcopy, exit... — see Built-in native functions.
Tooling:
- REPL:
ton618with no arguments;ton618 -e "code"for one-liners. - Better errors: the source line, a traceback through function calls, "did you mean ...?" for misspelled names, and line numbers on errors from native functions.
- Catchable recursion limit (10,000 calls) instead of a crash.
- A regression test suite (
tests/,make test, run by CI).
Behavior changes:
- Numbers print in their shortest exact form:
3.14instead of3.140000,0.5instead of0.500000(also instr(),json()and string concatenation). continueinside aswitchinside a loop now continues the loop (it used to be swallowed by the switch).- Errors from native functions caught with
catchnow start withError at line N:like every other runtime error. - A closure created inside a
for ... inloop captures that iteration's variable (it used to see the last value).
Performance: about 6x faster on typical code — names are resolved through interned symbols, scopes are flat vectors, control flow no longer uses C++ exceptions, and blocks that declare nothing don't allocate a scope.
beta-1.0.10 — tensor_to_bytes/tensor_from_bytes, real binary files:
tensor_to_bytes(t)/tensor_from_bytes(bytes, shape): pack/unpack a tensor's data as raw IEEE-754 float64 bytes. Combined withwritefile/readfile(which now open files in binary mode, so bytes round-trip exactly on Windows too, not just Linux/Mac), this is what lets a.tonmodule write real binary files — no more encoding numbers as JSON text and losing precision tojson_stringify's ~6-significant-digit rounding. The communityatomemodule's.atmmodel files now use this instead of JSON.
beta-1.0.9 — --uninstall-ton also removes ./modules/:
- Behavior change:
ton618 --uninstall-tonnow also deletes the current directory's whole./modules/folder (every module previously fetched there withton618 install <module>), in addition to removing the binary and its PATH entry. The standalonescripts/uninstall.sh/uninstall.ps1do the same. If you only want to remove one module, useton618 uninstall <module>instead — see Installing modules.
beta-1.0.8 — ton618 install/uninstall normalize module names to lowercase:
- Bugfix:
ton618 install <module>now lowercases the module name before building the GitHub raw-content URL and the local./modules/<name>.tonpath (the registry lookup itself still uses the name exactly as typed). Every existing module follows the lowercase-filename convention (atome.ton, etc.), andraw.githubusercontent.comURLs are case-sensitive, so a registry entry published with any other casing (e.g.Atome) used to 404 instead of finding the real, lowercase file at the repo root.ton618 uninstall <module>was updated the same way, so it keeps targeting the fileinstallactually wrote.
beta-1.0.7 — tensor_argmax and tensor_conv1d:
tensor_argmax(t): the index of the largest element (or one per row for a 2D tensor).tensor_conv1d(signal, kernel, [stride]): 1D convolution (cross-correlation) on single-channel tensors — the primitive the communityatomemodule builds its (multi-channel, autograd-tracked) Conv1D layer on top of, verified against a numerical gradient check.
beta-1.0.6 — ton.tensor, a native module for basic ML work:
- New built-in module
ton.tensor: 1D/2D numeric arrays with element-wise ops, matrix multiply, transpose, reductions, common activations (relu/sigmoid/tanh/softmax) and their gradients, plus array/tensor conversion — implemented as real C++ loops for a genuine speed-up over the equivalent hand-written TON618 loop. CPU only, no autograd built in — see ton.tensor for the full function list and its honest limits. The communityatomemodule (ton618 install atome, once published) is built on top of it and gained a 5-16x speed-up switching to it, with zero change to its own public API.
beta-1.0.5 — bitwise operators and spread:
- Bitwise operators:
&,|,^,~,<<,>>, plus their compound-assignment forms (&=,|=,^=,<<=,>>=). Operands are truncated to 64-bit integers, operated on, and converted back — see Operators. - Spread (
...) in array literals:[...a, x, ...b]splices other arrays' elements in place — see Arrays. - Spread (
...) in dict literals:{...d1, key: val, ...d2}merges other dicts' entries in place, later entries overriding earlier ones with the same key (in their original position) — see Dictionaries.
beta-1.0.4 — ton618 uninstall <module>, and a clearer name for the old --uninstall:
ton618 --uninstall(which removed theton618interpreter itself) is renamed toton618 --uninstall-ton, to make room for the new command below and avoid the two being confused.ton618 uninstall <module>: removes./modules/<module>.ton— the counterpart toton618 install <module>(see Installing modules).
beta-1.0.3 — new operators, flexible function parameters, and finally:
- Default parameters:
function greet(name, greeting = "Hello") { ... }— the default is evaluated at call time, in order, so a later default can reference an earlier parameter. - Rest parameters:
function sum(...nums) { ... }collects any extra arguments into an array; may be mixed with fixed parameters as long as...is last. Arity-error messages now adapt (expects between 1 and 2 argument(s),expects at least 1 argument(s)). ??(nil-coalescing operator):value ?? fallbackreturnsvalueunless it'snil, in which case it returnsfallback— the fallback is never evaluated otherwise (short-circuiting). See Operators.in(membership operator):value in array,value in dict(tests keys),value in string(substring test). See Operators.finally:try/catchgained afinallyblock that always runs — on success, on a caught error, or through areturn— andcatchis now optional as long asfinallyis present (try { ... } finally { ... }). See Error handling.ton618 install <module>: fetches a module's metadata from the TON618 module registry and downloads its code straight from GitHub into./modules/. See Installing modules.- A new AI skill for authoring TON618 modules (as opposed to writing scripts), alongside the existing general-purpose skill — see
exemples/skills/ton618-module-author/.
beta-1.0.2 — simpler string formatting, and an AI-coding skill:
- String interpolation (
"Hello ${name}!") has been removed in favor of the much simplerformat(template, ...args):format("Hello {}!", name). Interpolation required the lexer to recursively re-lex arbitrary expressions embedded inside string literals (tracking nested quotes and braces) — a lot of machinery for what a single string-processing function does just as well, with far less to reason about. See String formatting. - An AI-coding skill for TON618, in both a Claude Code
SKILL.mdand a genericAGENTS.md, so an AI agent can write correct.tonscripts without re-deriving the language from this document — see the "Skills for AI" link next to the playground, orexemples/skills/.
beta-1.0.1 — bug fixes, new syntax, and a much larger standard library:
Correctness fixes:
<,<=,>,>=now type-check and support strings: previously they silently compared the internal number field regardless of type, so e.g."apple" < "banana"evaluated as0 < 0(false) instead of comparing lexicographically. They now compare numbers numerically, strings/html lexicographically, and error on any other combination.==/!=now do structural equality for arrays and dicts (recursively, element-by-element) instead of always being "not equal" to each other regardless of content; a string and an html value with the same text now also compare equal.%now errors on division by zero instead of silently producingNaN, matching/.
New syntax:
- ~~String interpolation~~ — added here, replaced by
format()in beta-1.0.2 (see above) switch/case/default, with no fallthrough and support for multiple values per case- String indexing:
s[0]reads a character (strings stay immutable — assigning to an index is an error)
New standard library:
- Three new built-in modules:
ton.encoding(base64/hex/URL),ton.regex(backed by<regex>),ton.path(path manipulation) - New always-available natives:
find,any,all,writefile - New
ton.os:os_appendfile,os_readlines,os_isfile,os_isdir,os_rename,os_tempdir,os_copy - New
ton.strings:strings_trim_start,strings_trim_end,strings_words,strings_center,strings_replace_first,strings_snake_case,strings_camel_case - New
ton.mathutils:mathutils_min_of,mathutils_max_of - New
ton.json:json_pretty - New
ton.sys:sys_arch,sys_version;sys_platform()now also recognizes"termux"
Local server:
- Route handlers now receive the request as a
ton.dict({method, path, query, params, body}) instead of being called with no arguments — a breaking change from beta-1.0.0, closing the previous "can't read POST body or URL params" limitation. Routes can use:namepath segments (/user/:id).
Distribution & tooling:
- Precompiled binaries are now built and published by GitHub Actions (
.github/workflows/release.yml), cross-compiling Linux x64, Windows x64, and Termux/Android arm64 on every tagged release ton618 --update [version]: re-downloads the binary matching the current platform from GitHub Releases and replaces the running oneton618 --version/-v: prints the version, auto-detected platform, and architecture.github/workflows/pages.ymlpublishesexemples/(docs + playground) to GitHub Pages, with custom-domain support (exemples/CNAME)- The browser playground (
ton618-lite.js) now also implementston.mathutils,ton.strings,find/any/all,json_pretty,switch/case, and string indexing — closing several gaps where it silently behaved differently from the real interpreter
Earlier language additions (pre-beta-1.0.1):
- Compound assignment:
+=,-=,*=,/=,%= - Increment/decrement:
++,--(postfix, on variables and indexed targets) - Ternary operator:
cond ? a : b for ... inloop over arrays and dicts, alongside a classic C-stylefortry/catch/throwerror handlington.dicttype, with{key: value, ...}literals,[]indexing, andkeys()/values()/has()- Function expressions:
ton.function(params) { ... }as an inline value, for callbacks - A large standard library:
type,assert,input, math/string/array/dict helpers,map/filter/reduce - A documented module-writing guide, and eight (now eleven) built-in system modules
- A browser playground (
exemples/playground.html, backed byexemples/ton618-lite.js) documentation.htmlrendersDOCUMENTATION.mddirectly (embedded at edit time viamake docs)