Skip the bullshit
// docs / Language

Web stuff we added

Route parameters, page titles, JavaScript events, maps and tuples. The things a web language needs, one Milestone late.

A route segment :name matches one path segment and binds name: String in its arm. meta(title: ..., description: ...) sets the page title and description while it is shown, and prerendered pages get them too.

vcwl
component Post(id: String) {
meta(title: "Post " + id, description: "A post")
heading(1, "Post " + id)
}
component App {
state last: String = ""
on js "chat"(msg: String) {
last = msg
}
routes {
"/post/:id" => Post(id: id)
_ => paragraph("last: " + last)
}
}
→

prerender_routes = ["/post/1"] in vcwl.toml prerenders concrete URLs; other parameter URLs are served by 404.html.

→

JavaScript calls window.vcwl.dispatch("chat", value); on js "chat"(msg: T) receives it, decoded like a fetch result. websocket(url, event) from @web turns every message into such an event.

→

Tuples (Int, String) with t.0 and let (a, b) = t; Map<V> with String keys (JSON made us); Set of Strings; chars() and char_len() count code points.