| Crates.io | wartcl |
| lib.rs | wartcl |
| version | 0.1.3 |
| created_at | 2025-02-07 00:21:20.208339+00 |
| updated_at | 2025-02-08 19:54:53.770898+00 |
| description | A minimal embeddable Tcl-like language |
| homepage | |
| repository | https://github.com/cbiffle/wartcl |
| max_upload_size | |
| id | 1546318 |
| size | 106,039 |
wartcl: a minimal Tcl-like language in RustThis is a rewrite/reimagining of partcl in Rust, targeted at small embedded
(no_std) systems.
wartcl is pronounced WAHR-tih-cull, after the tongue-in-cheek name for
phenomena that exhibit wave/particle duality in quantum physics. Since values in
Tcl collapse into different things (strings, numbers, programs) depending on how
they're observed.
Compared to Tcl a lot of things are missing:
partclDo not take the existence of wartcl as a negative commentary on partcl. It's
intended as more of an homage.
Like partcl, this implements a Tcl-like language, not Tcl. wartcl mirrors
partcl's structure and shares many of its limitations:
expr) support. Math operations must be written
prefix, like == 1 2.This implementation passes the same testsuites as partcl with some light
changes, which are documented at the beginning of the test section of lib.rs.
(In brief: partcl relies on the ability to do out-of-range accesses that read
NULs at the end of strings; in Rust we don't NUL-terminate our strings so some
functions had to change.)
Ways this is different from partcl:
wartcl is entirely written in safe Rust, which of course means no risk of
out-of-bounds accesses, memory leaks, or segfaults, but more importantly,
also means no cryptic pointer arithmetic in for-loops in macros, so the code
is much easier to follow.
wartcl runs about 4x faster across the board than partcl, despite having
significantly more error checking. (Memory safety means I can more confidently
apply aggressive optimizations.)
wartcl is somewhat shorter, despite not using as aggressively dense of a
coding style as partcl (not packing multiple things on one line, longer
variable names, etc).
Commands registered with the tcl engine can be arbitrary closures, instead of
function pointers with a void* argument, so commands can reference and share
as much (or as little) data as they need without losing type safety.
wartcl fixes several bugs (if syntax, error propagation from procs, etc.).