Why Janet? (2023)
Syntax, Lispy Style, and Readability
- Many like Janet’s “modernized Lisp” naming (
fn,first,do,set) and consistent s-expressions, especially for trees/JSON/DSLs. - Others still strongly dislike Lisp parentheses, finding them hard to read/edit, particularly for math-heavy or long expressions.
- Some argue syntax complaints are overblown given good editors (Parinfer, structural editing) and that all mainstream languages have ugly or inconsistent syntax in different ways.
- Square brackets used for parameters and vectors (à la Clojure) are polarizing; some find the convention elegant once learned, others can’t get over it.
Performance and Implementation
- Janet is reported as roughly in Lua (PUC-Rio) territory; some benchmarks show ~5–10x faster than Python for long runs, slightly slower than Fennel on LuaJIT, and even beating Go for small, compile-time-heavy tasks.
- It has a threaded bytecode VM; not JIT-level, but viewed as “fast enough” for scripting and small tools.
- Global state is thread-local; one
janet_init()per thread. Suitability for complex multi-interpreter/multi-thread embedding (e.g., audio plugins) is debated.
Macros, DSLs, and Compile-Time Power
- Macros and homoiconicity are a major draw. Examples include infix math DSLs, SQL-like/dataframe query DSLs, APL/J-style vectorization, and web query DSLs.
- Janet makes it easy to shift heavy work to compile time (e.g., embedding large data tables as literal structures in the binary).
- Some emphasize that the “Lisp moment” comes from REPL-driven development, structural editing, and treating code as data, not just from macros alone.
Parsing: PEGs vs Regular Expressions
- Janet promotes PEG-based text parsing over regex.
- Supporters say PEGs are clearer and more powerful for complex grammars.
- Critics call PEGs an “evolutionary dead-end,” point out non-commutative alternatives and tricky debugging, and note real grammars can expose parser weaknesses.
- Others counter that regex engines also have order-dependent behavior and backtracking pain.
Embeddability, Sandboxing, and Use Cases
- Embeddability is a key selling point; people use Janet for scripting, markup with embedded scripts, game engines, web services, and small binaries.
- Built-in sandboxing (disabling feature sets irreversibly) is praised for safely embedding untrusted code or limiting utilities’ capabilities.
- Built-in networking and a shell DSL make it attractive as a replacement for
sh/Python/awk for larger system scripts.
Ecosystem, Tooling, and Comparisons
- Positives: small, simple core; fast startup; ability to build static binaries; community docs and tutorials; real production use (web apps, tools, art software).
- Negatives: limited library ecosystem (e.g., HTTP tooling, TLS, routing), weak package versioning, and some confusion over “immutable collections” that are often returned mutably by the stdlib.
- Often compared with Clojure (immutability, data focus), Lua/Fennel (embedding, speed), Tcl (DSLs, scripting), and Babashka (shell scripting). Preferences vary by platform, data-processing needs, and startup/perf tradeoffs.
AI, Communities, and Meta-Discussion
- A large subthread veers into “AI-free communities,” spam/bot defenses (web-of-trust, identity verification, paywalls), and how AI affects leaderboards and forums.
- Some praise human-moderated spaces and express ideological opposition to LLM-generated content; others find outright bans or purity tests alienating.