The road to 1.0
Rook is at 0.x: the language works, and this site is written in it, but the specification is a draft and may still change. The goal is 1.0, a language to use in production, with a stable core and the tools a team expects. This page says where Rook stands, what is missing and in what order it will come.
Rook does not try to be a wider TypeScript. Its place is real threads in the browser and in Node, checked by the compiler, and UI without a framework, in a language that compiles to readable JavaScript you can keep. Each phase below makes that place stronger.
New syntax comes from the list "The language for 1.0" below, each piece as the maintainer decides it; other ideas wait for 1.0.
Rook today
What is already there
| Concern | How it is |
|---|---|
| Goroutines are an emulation on the event loop | go f(x) runs f on another thread, a Web Worker or a Node worker thread (Goroutines). Inside a thread, channels and select work on its event loop, as async code does. |
| Data races, as in Go | What goes to another thread is copied or moved with transfer(x), and the compiler checks that it can be. Memory is shared only through a SharedArrayBuffer made for it. |
| The runtime makes the bundle bigger | A module imports only the functions of rooklang/runtime its code uses; a program without channels, goroutines or markup imports none. All of the runtime is about 19 KB gzipped, before minification. |
| There are no libraries | Rook imports any JS module and takes the types from TypeScript declarations (Modules): the libraries of Rook are those of npm. |
| A Rook component cannot go into a React or Vue app | @html-tag makes a component a custom element that React, Vue, Svelte and plain HTML use as any other (Web components). |
| TypeScript code cannot use Rook modules | rook build writes a .d.ts next to each .js. |
| Debugging is blind | Source maps: stack traces, in goroutines too, and debuggers show the lines of the .rk file. |
| Builds and tests | The Vite plugin rooklang/vite; Vitest runs Rook code, goroutines included (Tools). |
What is not there yet
- Stability. The specification marks its experimental sections, but the compiler does not warn of deprecated forms yet.
- The editor. The VS Code extension shows errors as you type, completes and has quick fixes, but has no hover, go to definition, references, rename or outline.
- The command line.
rook buildandrook run; no formatter, nocheckfor CI, no template of a project. - Debugging goroutines. A deadlock is not reported, a goroutine left waiting is not shown, and the workers in DevTools have no names.
- Numbers. There are no benchmarks of channels and goroutines against plain JS, and none in CI.
- TypeScript under Vite. The Vite plugin does not write
.d.ts, so a.tsfile that imports a.rkmodule there seesany. - Comments in the output. The generated JS keeps the names and the structure of the source, but not its comments.
Not locked in
Rook compiles to readable JavaScript with the same names and structure. A project can build its .rk files once with rook build and go on in JS. What stays is the rooklang/runtime import of the code that uses channels, goroutines or markup: plain JS under the MIT license, which can be kept as a dependency or copied into the project. The guide shows how: Rook in an existing project.
The road to 1.0
Phase 0: say what is there (done)
- This roadmap, on the site and in the repository.
- A section of the guide on using Rook in an existing project: a
.rkmodule in a Vite project, a Rook component in a React app, and leaving Rook with the generated JS.
Phase 1: stability (in progress)
- A changelog. In 0.x a minor version may break code, a patch version never does. Done.
- Every section of the specification marked stable or experimental. Experimental features may change in any release; stable ones only through deprecation. Done.
- Deprecation: the old form keeps working for at least one minor version with a warning that shows the new form, then it is removed.
- Snapshots of the generated code of the examples, so that every change of the output shows in the diff. Done.
- Comments of the source in the generated code.
- The open questions of the design of components decided: the threshold of inlining stays a constant, and the names of
@keyframesstay global. Done. The rest is the language for 1.0.
The language for 1.0
1.0 is to be as complete as it can. Each item is decided by the maintainer first, then implemented.
- Keys of lists in markup:
{for todo in todos with key todo.id { ... }}. Done. - A union of interfaces narrowed by a field of a literal type:
if d.kind == "courier"givesd.address. Done, with the narrowing of paths:order.delivery.kind. derivedof several statements:derived total number { ... return sum }. Done.- Combining decorators, and
public refin decorators:dec card() includes framed, likes. Done. - A component that returns
nullfor a wrapper. - Refs in
{if},{switch}and{for}, and one ref in several returns. rook build --explain: where the compiler did not inline, and why.- Components on the server: markup as a string of HTML, components that return any value, decorators as guards and context.
- The CSS of components in a file of its own, and the class of a style only on the elements that its selectors can match.
- A program without
any: every value has a type it can write, from the.d.tsof the libraries and the platform, from where it goes and from the declarations of the program; no part of Rook itself makes a program useany.
Phase 2: tools
- The language server: hover with the type, go to definition, find references, rename, signature help, document symbols.
rook fmt: one style, no options, asgofmt; and formatting in the editor.rook check: type checking only, for CI and pre-commit hooks.rook init: a new project with Vite, Vitest and the settings of VS Code..d.tsof.rkmodules under the Vite plugin.
Phase 3: debugging goroutines
- Deadlocks: when every goroutine waits on a channel and no timer can wake one, the program stops with an error that says where each one waits.
rook run --trace: when the program ends, the goroutines still alive and what each waits for.- Workers named after the function of the goroutine, as DevTools shows them.
Phase 4: performance
- Benchmarks of channels,
select, goroutines,go forand updates of markup against the same programs written in JS by hand: the numbers on this site, and a run in CI that fails on a regression. - Optimizations of the generated code only where a benchmark shows the need. Minifying is the work of the bundler.
1.0
Rook is 1.0 when:
- the specification is no longer a draft: its core is stable, and deprecation works as described;
- everything of the language for 1.0 is in;
- the language server has navigation and rename; there are
rook fmt,rook checkandrook init; - deadlocks are reported and goroutines left alive are shown;
- benchmarks run in CI, and their numbers are on this site;
- the guide shows how to bring Rook into a project and how to leave it.
The same plan is in the repository: docs/roadmap.md.