Why Janet? A Lisp dialect worth a weekend
Janet is a small imperative Lisp with only eight core instructions, a single namespace, lexical scoping, and a standard library that fits on a page. Its runtime semantics are close enough to JavaScript that an experienced programmer can pick it up in an afternoon, but the macro system and compile-time evaluation give it ceiling well above scripting-language peers.
The practical case rests on distribution and text handling. Janet compiles itself to bytecode, embeds that into a generated C file, and links the runtime statically, producing self-contained binaries under a megabyte that ship without dependencies. For text and process work, parsing expression grammars replace regex with composable parsers that handle multi-line, binary, and non-regular formats, while the third-party sh library provides pipe-and-redirect shell syntax that competes with Bash for small tools.
What sets Janet apart is its treatment of compile time as a first-class environment: any value, including closures and generators with preserved state, can be serialized as a snapshot and resumed at runtime. That makes macros only one application of a broader capability — precomputing game data, embedding assets, or generating bindings from a schema all fall out of the same mechanism. Add mutable and immutable collections with proper value semantics, easy C embedding, and a syntax that distinguishes mutability with @ prefixes, and the author argues Janet earns a place in any tinkerer’s toolkit.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.