Contour, Valence, Foundry
Three instruments for building inside Vision
Vision is FMVision’s own browser: the browser and launcher for the studio’s sites, worlds and workspaces. We describe three instruments for building inside it. Contour is a lightweight interface framework of HTML templates, explicit state and targeted DOM updates. Valence is for backend services that declare their capabilities. Foundry builds a Vision app from a brief. The three share one principle. The figures that follow are live, so that the reader may put it to the test.
Say what you mean, and let the machine do only that.
1The principle
FMVision ships meaning, not results. A world in Vision is not a recording of a world. It is the source of one: a few hundred kilobytes of text, from which the device grows everything else. There are no dependencies, no build step and no shipped assets.11A whole ocean world, Shark Reef, goes live about 100 ms after about 108 KB. The numbers are in §6.
The same rule can be applied to the building of apps. An app has three things to say: what it shows, what it is permitted to do, and what it is for. If each is stated plainly, the machine is left with nothing to guess, and nothing is shipped that was not meant.
The three instruments take one statement each. Contour takes the view: a template, and the state it depends on. Valence takes the permissions: a service declares its capabilities. Foundry takes the purpose: a brief, in sentences. Fig. 1 shows the path from the brief to a running workspace.
The remaining sections take the boxes in turn. In each we prefer a working demonstration to a description, since a demonstration cannot say more than it does.
2Contour
Contour is a lightweight interface framework. It has three parts, and all three are in plain sight: an HTML template, a state that is stated outright, and updates that go to the nodes which depend on what changed and to no others.
The idea is easiest to judge while it runs. Fig. 2 is a small tab strip of the kind Vision has, in which every tab carries a human name and a tab can be parked.22In Vision, Park frees a tab’s memory and restores the tab on selection. In the figure, parking only sets a flag; there is no memory to free. It is built on this page from one template and one state object. Select a tab, or park one. The state is printed beside the view as it changes, and every node of the document that the update wrote to is outlined.
of 5 tabs live
The miniature is about fifty lines of plain JavaScript written for this page, and the instruments around it take somewhat more. It is not Contour, and its code is not Contour’s. The count beneath it is not taken on the miniature’s word, either: a separate observer watches the view and reports what was in fact written.33The outlines are drawn on a layer outside the observed view, so that marking a node does not count as touching it.
For comparison, the figure can be switched to rebuild its whole view on every change, which is the simplest way to be correct. What appears on screen is identical. The count is not, and a reader using the keyboard will find that the rebuilt view has dropped the focus as well.
Listing 1The update routine of Fig. 2, printed from the running page. Line 4 is the whole idea: a value that has not changed leaves its node alone.
Nothing here is clever. The template says where state appears, the state says what is true, and the update compares and writes. What is not said is not done.
3Valence
Valence is for the other half of an app: the backend services it relies on. A Valence service declares its capabilities. What it may do is written down beside what it does, where a person or a machine can read it before anything runs.
A declaration is what makes a check possible. Vision checks navigation and native capabilities per workspace, not once for the whole browser.44A workspace also loads only what it needs. See Table 1. The rule of such a check is as plain as a rule can be:
Fig. 3 lets the reader try Eq. (1). One column holds a declaration; the next, what a workspace asks for. Both can be changed. A request for something undeclared is refused, and the refusal is the only event of interest in the table.
| Capability | Kind | Declared | Asked | Result |
|---|
We stress the label on the figure. The real interfaces are not public, and none is shown here. What the figure does show truly is the shape of the arrangement: the permissions are a short text, the check is one line, and a capability nobody declared cannot be had by asking.
4Foundry
Foundry builds a Vision app from a brief. The brief is prose: a few sentences on what the app is for. Fig. 4 sets a brief beside the shape of what comes out, which is a workspace with a human name in its tab, a view, and the services it declares.
A reading list for the studio.a Each entry has a title, a note and a state: unread, reading or done.b I want to add an entry, change its state, and export the list as a file.c It needs nothing from the network.d
- cRecords
- read, write
- cFiles
- export
- dNetwork
- none declared
We show the two ends and not the middle. Fig. 4 documents no procedure, and we give no commands and no timings here. What it is meant to convey is correspondence: each part of the result can be traced to a sentence of the brief, and what the brief did not ask for does not appear. The last sentence of the brief asks for nothing from the network, and the last line of the declaration is empty.
5Where it runs
An app built this way runs as a workspace in Vision. Vision is a Rust and Tauri host on the system WebKit of macOS, with WebGL for worlds written by hand in GLSL. An iPad build and a Windows preview exist. Table 1 collects what a workspace can rely on.
Table 1What a workspace can rely on
| Matter | What Vision does |
|---|---|
| Loading | A workspace loads only what it needs. |
| Checks | Navigation and native capabilities are checked per workspace. |
| Tabs | Every app has a human name in the tab strip. ⌘L reveals the address. |
| Park | Parking a tab frees its memory. Selecting it restores it. |
| Telemetry | First-party only: load times and frame pacing. Never URLs, history, page contents, form values or credentials. |
| Advertising | No ad networks. No tracking scripts. |
| Host | Rust and Tauri on the system WebKit of macOS. An iPad build and a Windows preview exist. |
The launcher is Vision’s opening page and its New Tab. It keeps a Developer Tools section, whose shelf is given in Table 2. We name every entry and describe only those we can speak for here.
6Measure
A principle should be weighed. The numbers we have come from worlds, not from apps, and we give no others.55We have no measurements of Contour, Valence or Foundry to report, and so we report none. Shark Reef, a whole ocean world, goes live about 100 ms after about 108 KB. The compiled ocean it replaced took 12 s and 120 MB. Silfra, a whole world of rift, walls, boulders, water and light, is about 360 KB of source.
Table 3 sets these down and Fig. 5 draws them to scale. The last row is this page, which weighs itself when it opens.
Table 3Weights and times
| Object | Shipped as | Weight | Until live |
|---|---|---|---|
| Shark Reef | source | ≈ 108 KB | ≈ 100 ms |
| The ocean it replaced | compiled | 120 MB | 12 s |
| Silfra | source | ≈ 360 KB | · |
| This page | source, one file | · | · |
A dot marks a quantity we have not measured. The weight of this page is computed in the reader’s browser on opening.
We draw one conclusion and no more. Where the thing shipped is a statement of what is meant, it is small, and the smallness is not an economy made afterwards. It is what is left when nothing else was said.
Vision is in private release.
Contour, Valence and Foundry are inside it. If you build things, and would rather say what you mean, we would like to hear from you.