Part I · Mental Model & Rosetta Stone
Chapter 1
The Veko Rosetta Stone & Language Ergonomics
Side-by-side Go, Rust, Python, and TypeScript translations plus Day-1 vs Day-14 fluency scores
Whitespace Disambiguation & Two-Pass Pratt Homoiconic Engine
How [tight] vs [spaced] tokens let kebab-case prefix calls coexist cleanly with infix math, UFCS chains, and macros.
| Component & Module | Architectural Role |
|---|---|
4 Whitespace Ruleslexer.vk | Eliminates grammar ambiguity using single-character attachment flags. |
First-Class Literalslexer.vk | Parses human-readable durations, binary sizes, hex/binary ints, and UTF-8 strings. |
Pass 1: Signature Scanparser.vk | Collects top-level function arities, refinements, structs, and module imports. |
Pass 2: Pratt Precedenceparser.vk | Binds tight postfix chains, prefix word arguments, infix math, comparisons, and \ pipes. |
quote & composemacro_eval.vk | Treats [ ... ] blocks as inspectable values and splices computed expressions cleanly. |
parse-block Dialectsparser.vk + lib/dialect.vk | Matches typed pattern rules over homoiconic blocks to drive custom DSLs. |
Recipe 1.1: Translating Go, Rust, Python & TypeScript Habits into Idiomatic Veko
Newcomers write fluent Veko fastest when they see familiar constructs side-by-side with their idiomatic Veko counterparts:
| Task | Go / Rust / Python / TS Habit | Idiomatic Veko (.vk) |
|---|---|---|
| Call a 2-arg function | os.WriteFile(path, data) | os/write-file path data |
| Nested call in math / loop | while i < len(items) | while i < (len items) [ ... ] |
| Call a 0-arg function | hostBinPath() | host-bin-path |
| Subtraction & division | n-1, total/count | n - 1, total / count (spaces required!) |
| Negative literal argument | seek(fd, -1) | seek fd -1 (tight -1, spaced after fd) |
| Strings & interpolation | f"https://{host}:{port}" | `https://{host}:{port}` or 'literal\n' |
| 1-arg method chains | raw.trim().toLowerCase() | raw.trim.lower |
| Multi-step data pipeline | items.filter(...).map(...) | items \ filter fn [x] [...] \ map fn [x] [...] |
| In-place buffer mutation | buf.push(10) / push(&mut buf, 10) | bytes/push mut buf 10 (mut on both sides) |
| Fallback on error / missing key | if err != nil / try...catch | port = str/to-i64/or raw [ 443 ] |
| Propagate contextual error | return fmt.Errorf("...: %w", err) | raw = os/read-file/or p [e -> return (err read {p}: {mold e})] |
| Unit return / JSON null | None / null / () / nil | .ok (unit action) and .null (wire JSON null) |
Recipe 1.2: Side-by-Side Service Function — Go & Rust vs. Veko
Consider loading a JSON peer list over HTTPS with a 3-second timeout, falling back to a local cache file, filtering active endpoints, and returning trimmed URLs.
In Go (imperative error sprawl):
func activePeers(endpoint string) ([]string, error) {
client := &http.Client{Timeout: 3 * time.Second}
resp, err := client.Get(endpoint)
var raw []byte
if err != nil {
raw, err = os.ReadFile("peers.cache.json")
if err != nil {
return nil, err
}
} else {
defer resp.Body.Close()
raw, err = io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
}
var peers []Peer
if err := json.Unmarshal(raw, &peers); err != nil {
return nil, err
}
var urls []string
for _, p := range peers {
if p.Active {
urls = append(urls, strings.TrimSpace(p.URL))
}
}
return urls, nil
}In Idiomatic Veko (peers.vk):
use [nc = net/client, j = json]
pub active-peers = fn [endpoint str] block[str] [
raw = (nc/get/or endpoint (nc/RequestOpts { timeout = 3s }) [
body_str = os/read-file/or 'peers.cache.json' [e ->
return (err `peer lookup failed: {mold e}`)
]
nc/HttpResponse { status = 200, reason = 'OK', headers = {}, body = (bytes/from-str body_str), final_url = endpoint }
]).body
(bytes/to-str raw)
\ j/decode
\ filter fn [p] [ p.active ]
\ map fn [p] [ p.url.trim ]
]Notice how Veko eliminates both hidden exceptions and repetitive if err != nil blocks while keeping every failure boundary explicit on the page.
Recipe 1.3: Readability & Writability vs. Other Languages
Because Veko combines single-owner ORO systems memory (Native, WebAssembly 3.0, and 64-bit VM targets with zero GC pauses) and Rebol/Elixir-inspired expression ergonomics, its learning curve splits distinctly between Day 1 familiarity and Day 14 fluency:
| Dimension | Score | Why |
|---|---|---|
| First-hour familiarity | 5.5 / 10 | Unlearning f(x), n-1, "strings", and null takes deliberate attention for the first few hours. |
| Steady-state readability | 9.0 / 10 | Near-zero syntactic noise; explicit mut at call sites; /or eliminates both hidden exceptions and 4-line error boilerplate; linear \ dataflow. |
| Steady-state writability | 8.5 / 10 | Very low ceremony, gradual types (prototype dynamically, lock down --strict-types for production), and homoiconic blocks/templates. Slight tax from fixed-arity memorization and explicit mut. |
- vs. Go (Readability: Veko >= Go | Writability: Veko > Go): Go and Veko both reject hidden magic. Veko pulls ahead on signal-to-noise ratio by replacing vertical
if err != nil { return nil, err }repetition with inline/or [ ... ]and\pipelines, while Go leads on Day-1 C-syntax familiarity and third-party IDE ecosystem size. - vs. Rust (Readability: Veko >> Rust | Writability: Veko >> Rust): Both enforce ownership, explicit mutation (
&mutvsmut), and zero-GC safety. Veko delivers single-owner determinism, shared-nothingspawn/chan, and.secrettaint safety without<'a, T: Send + Sync + 'static>,Arc<Mutex<...>>, or turbofish::<>noise — trading away only complex multi-lifetime borrow graphs. - vs. Zig (Readability: Veko > Zig | Writability: Veko > Zig): Zig's
catch |err|andorelseare close cousins to Veko's/or, and both prizedeferand explicitness. Veko is faster to write and scan for networking, CLI, codec, web, and backend work (built-in strings/maps, backtick templates, pipes, gradual typing), while Zig stays lower-level for raw OS kernels or custom allocators. - vs. Elixir / Clojure / Rebol (Readability: Veko >= Elixir, > Clojure/Rebol | Writability: Tie): Captures Elixir's
|>(\in Veko) and Lisp'squote/composehomoiconicity without outer parenthesis walls — and solves classic Rebol's dynamic-arity scaling hazard via lexical scoping, explicituse/pubmodules,mutborrow checking, and--strict-types. - vs. Python / TypeScript (Readability: Tie | Writability: Day-1 Python/TS > Veko; Maintenance Veko > Python/TS): Python and TypeScript feel effortless on Day 1 because everyone already knows their syntax, whereas over time hidden exceptions,
None/undefinedlandmines, shared-reference mutation, andasync/awaitcoloring erode clarity. Veko reads like clean pseudocode while encoding mutation, errors, secrets, and capabilities directly on the page.