SAVANT//GATEWAY
Back to Signal
DiscussionHacker News (AI filtered)Nov 24, 2026ilamont

Declare is a UI language for you and your AI

Just as SQL is a domain-specific language for database queries, Declare is a DSL for user interfaces — built to take that custom, fluid UX you have in mind past the prototype stage, into a real app, in verifiable code that stays true to your design.

A calendar that zooms through time, a desktop with real windows: complete programs, each readable end to end and checked by the compiler. Open one, or edit it live in the browser you’re using.

Day, week, month and year views are one surface, zooming continuously; a view doesn’t so much switch as become the next view, and every motion can be interrupted. It runs on real data: drag an event to another day, and it’s moved.

lines of code, plus 228 of comments — four views, zoom, drag and edit

over the wire as deployed, gzipped — app (structure, logic, styling) and runtime

lines typed by hand — human-designed and directed, built with AI

Windows that drag, resize and minimize into live thumbnails, a magnifying dock, and apps running inside its windows, all in one program.

3549 lines — 2028 code, 941 comment · 270 kb over the wire as deployed · every pixel drawn from shapes, no image assets

1,000,000 issues · search as you type · edit in place, with undo · virtualization built in

1508 lines — 983 code, 251 comment · 196 kb over the wire as deployed, before its data · no dependencies

Declare is designed for people who make interfaces. Layout, motion, states, theming and drawing are part of the language itself, not libraries bolted on, so the experience you’re building can be expressed directly, in code that captures your intent.

Three things follow one value: the number, the bar’s length and its color. Click to change v and all three update together, because each is a relationship that stays true and runs every time.

Your AI can write the code. Can it tell when it’s wrong?

Declare comes with tools that help an AI get it right.

One installable skill: the language, the library, the conventions, the working loop, so there’s nothing to reconstruct from a repository. And declare-help answers any name or error code on demand.

Every diagnostic names the broken rule and the valid rewrite. Try it: change textColor to color in the panel above and read what comes back.

The Inspector can tell you or an agent why a live value is what it is, what it depends on, and what happens if you change it, read from the running app.

verify checks an app in six steps, from parsing it to comparing screenshots, and stops at the first step that finds a problem, saying what it found.

Given the same brief, the same agent built a ticket-buying app twice. The Declare app was 1,279 lines to React’s 2,666, and its first build that ran passed all eleven hidden checks; React’s passed six. These are single runs, not yet a benchmark. Every run is in the repository.

The spec is small and the tools are strict, so there’s a lot less that can go wrong.

AI writes most code now. You tell it what you want to build, and it uses whatever language it likes to get it done. Et voilà, the era of new programming languages is over. Therefore: English is the best, and final, programming language. Right?

I think that argument starts with the plain truth — programming languages don't play the same role they once did — but gets its conclusion wrong. Writing code is now nearly free, but trusting it is as expensive as it's always been. An AI writing React checks its work by resemblance ("this looks like the billion lines I was trained on"), but resemblance isn't correctness. Meanwhile, less and less code passes under human eyes. That leaves the language and its tools as the one reviewer that's always there. Handing the coding to a machine makes the language matter more, not less.

Expressive. A language that can concisely describe a real interface: not just simple data entry screens, but fast, polished, custom-designed software meant to be used, even enjoyed, by actual humans. Views that become the next view, motion that carries meaning, layouts that answer to content and to the screen they're on.

Verifiable. A language designed to be learned, written, debugged and tested by AI, whose programs a compiler can check rather than guess at, without sacrificing human readability.

Most attempts to make code safe for machines make it duller for people. Declare doesn't accept that tradeoff. The features that make a program checkable (one tree for structure, style and behavior; every dependency visible to the compiler; one decider for each value) are also what make it short, and readable to the person who has to judge it. The whole language fits in an AI's context window, and in your head.

A well-designed user experience is a set of decisions: how it should look, how it should move, what should happen when. Those decisions are yours. An AI can produce a standard-looking app easily, and in Declare it can produce one verifiably. What it can't supply is a custom-crafted design. Declare is for people who want to go beyond prototyping these experiences with AI, to building structured, verified, accessible apps with it.

That's why layout, motion, states, theming and drawing are part of the language itself, not libraries bolted on: a Spring on an attribute, a layout as a value a view holds, a mode as a state you're in or not. The continuous version of an interface is often less code than the discrete, screen-by-screen version. And, because a Declare program is one complete description — no separate stylesheet, no framework lifecycle, no build of a dozen files — the design you meant is written plainly in the code, where you, a colleague or an AI can read it back and see that it's still what you meant.

What an AI gets from a mainstream stack is familiarity: fluency by imitation, which is broad, shallow, self-contradictory and unverifiable. The alternative is understanding: a language small enough to hand to a model whole, regular enough that its programs can be analyzed rather than pattern-matched, and backed by a compiler whose every error names the fix, because the reader of those errors is as often as not an AI deciding what to do next. Familiarity arrives free with popularity. Understanding has to be designed in, and it's an advantage only a new language can have.

There's research behind this approach: a small language handed to a model in context has beaten the same model writing Python (study), and a compiler that explains its errors measurably improves a model's repairs (study).

I built Declare the way it's meant to be used: eval by eval. (An "eval," in AI-speak, is a test drive with the AI at the wheel and me taking notes.) An agent that had never seen the language got a written application spec and the Declare download, and built the app while I watched how long it took, what it tripped on, what it found missing, how well its code read and how well the app worked. Another agent built the same spec in React. I've done this over a hundred times. You could call it recursive self-improvement, except that what improves isn't the AI but the language. Languages usually evolve over years; Declare did it in weeks, with feedback from a user who never gets tired and writes down everything that confused it. The same ticket-buying app went from 48 minutes to build to 24, and compiler errors per build from 32 to 6. In the latest pair the Declare app was 1,279 lines to React's 2,666, and its first build that ran passed all eleven hidden checks; React's passed six. These are single runs, not yet a benchmark. The runs, in full

Custom-designed experiences, as seen in the best native apps, have their own components and continuity, where one view becomes another instead of a sequence of screens. They've always been bespoke, locked to a platform, and can be wrong in ways that are hard to catch. This is also among the least machine-writable code there is, because the corpus for it is thin. Declare makes continuity, motion and custom components the grain of the language, and puts it where a compiler can check it. One example is the calendar, whose day, week, month and year views are one zooming surface, in about 600 lines. A human (me!) guided it; AI wrote it; the compiler, inspector and checker caught its mistakes.

I don't believe computing collapses into a chat window; we still need apps. The next generation of great apps will go beyond today's hand-crafted best: continuous rather than screen by screen, opened instantly from a link, and shaped by people who know how software should feel, with an AI writing much of the code. Declare is built for them.

I co-founded Laszlo Systems and led the team behind OpenLaszlo — a declarative UI language, first shipped in 2002, that pushed right to the edge of what that era’s web browsers could handle.

What brought me back to UI development was Mesa, a zoomable canvas app I built without using a browser framework, toolkit, or higher-level language. Mesa renders a thousand live objects at a 60fps floor, even on a phone. It’s been positively amazing to see how fast today’s browsers have become — and how powerful and flexible today’s web platform is.

And yet the web as it actually stands is still, mostly, slow and clunky. Even brand-new sites. How can that be?

It turns out the browser isn’t what makes the web feel worse than a good native app. It’s what we’ve built on top of it. A lot of accumulated code — and a lot of accumulated habits — take their toll, and the interfaces that do escape them are hand-crafted, one at a time, by specialists.

In June I handed the original OpenLaszlo compiler to an LLM and got back a modern port that compiles any OpenLaszlo program perfectly, byte-for-byte.

Seeing those programs again through fresh eyes — and seeing how small and how fast the sites built with them are — I decided the language deserved to be modernized. Declare is what came out of that: a direct descendant of OpenLaszlo, with the core ideas intact, built on an entirely new foundation, and shaped to be written with an LLM.

Declare is a language for building application interfaces. This file is the language: every form the grammar accepts and every rule the compiler enforces. The compiler completes it — every error carries a code, a position, and the rewrite that resolves it (§12), so nothing here needs to enumerate edge cases.

Declare is new, and no LLM has been trained on it. It resembles React, CSS, and HTML in places, and this file is where those resemblances stop. Every complete program below is compiled by the test suite, so the examples are current by construction; where this file and the compiler disagree, the compiler is right.

The classes and their attributes are in the reference — npx declare-help <name> answers any of them by name. How to work with Declare, and where everything else is, starts at skill/SKILL.md.

One boundary makes the rest of this file readable. Every capitalized tag is a class — View, Text, and Image, but equally Dataset, State, Spring, and KeyListener. The language is the grammar that declares, instantiates, configures, and relates them, and that grammar is what follows.

A Declare program is a tree of nodes whose attributes are related to each other by standing expressions the runtime keeps true.

A constraint is a relationship, not a callback. Read a reactive value inside one and you are subscribed to it; assign to that value and everything that reads it updates. There is no re-render, no diffing, no dependency array, and no hook, because nothing was ever a render.

Click the button and the label updates; resize the window and it stays centered. You wrote no update logic for either, and there is nowhere to put any. Every section below is this same idea applied to structure, space, data, style, and time.

Two brackets carry the entire syntax. [ … ] holds a node's members — attributes, declarations, methods, children — and the bracket nesting is the tree. { … } is TypeScript, type-checked against every class's real API.

An attribute's value takes four forms, and the spelling tells you which:

A bare literal is the value itself, so a name is not one: fill = accent fails as a bare value. Reach a named value through braces — fill = { provided("theme").accent }.

Bare values have a small literal vocabulary the compiler owns: Lengths (100%), colors (navy, #336699), and keywords (center, x). Inside { } none of it exists. You are in plain TypeScript, an identifier means what TypeScript says it means, and the compiler never reinterprets it.

A body is TypeScript, written as TypeScript writes it: ternaries, template literals, array chains, closures, casts (x as T, x!), annotations on locals and parameters, generics, and a method body's own type, interface, enum and class declarations. Everything type-level is checked, then stripped; what TypeScript compiles (an enum, a class's parameter properties), the compiler compiles. One limit, a compile error naming the rewrite: a value body is a single expression — statements live in methods.

A :path may also appear inside a { } body, and this is central rather than exotic: it is how anything conditional over replicated data gets written. text = { :on ? :title : "—" } reads the datapath exactly as the bare form does, then computes with it in TypeScript. Read { } as "TypeScript, plus datapath reads."

Two lexical notes. A "…" string ends at its line, in a bare value as in a { } body; a """ block is the form for long text. And a Dataset's literal body is strict JSON (§7) — the one place { } is not TypeScript at all.

Everything inside [ ] is a member, in one of five shapes. Two of them look nearly identical and mean different things.

Any view can paint itself by defining draw(d: DrawContext) — graphs, gauges, iconography, marks no fill or font gives you. It is an ordinary method: View calls it from a constraint of its own (drawing = { record(draw) }), so it runs on invalidation and re-runs when what it read changes, never per frame — the same rule as any method a constraint calls. d takes the Canvas2D drawing calls (fillStyle, beginPath, moveTo, stroke, …); what it records, every renderer paints.

name = value sets an attribute that exists; name: Type = value declares a new one. Declaring is how reactive state enters a program; setting is how it is wired. A declaration's type is a TypeScript type — number, string[], "idle" | "busy", Map<string, Row>, { x: number; y: number }, [number, number], (id: string) => void, Row | null — naming TypeScript's built-ins, Declare's own (Color, Length, …), your classes, your schemas (§7), or a type a script block declares; object / array stand for a record or list of no declared shape, in a cast too. T? is Declare's shorthand for T | null, and takes ?.'s undefined as null. A type that a declaration cannot hold in place (a conditional or template-literal type) is named once in a script block and used by name. The one place a type meets the member syntax is a [ after it: glued and empty it is an array (w: Window[]); after a space it opens a named child (w: Window [ … ]).

A method's signature is typed, name-first: select() { … }, commit(v: boolean) { … }, quant(v: number) -> number { … }. Every parameter carries a written type — any type a declaration takes, an event payload among them (onPointerUp(e: PointerUpEvent)); c?: Menu, or Declare's c: Menu?, says the value may be absent, and the body must check. The return is written -> Ret or TypeScript's : Ret — a type's name (-> Week, -> Session[]), not a record written out in place: give a returned record a schema and return that. Omit it for a method that returns nothing. A computed value is still not a method but an attribute with a { } default, segIndex: number = { … } — an attribute stays reactively true; a method runs when called. A subclass's method, handlers included, replaces the base's of the same name, a built-in's own runtime methods (fetch, start, scrollTo) among them; super.name(args) calls the replaced one, wherever in the body it is written, or never.

Events from outside the tree come through a member you declare. KeyListener [ onKeyUp(e: KeyEvent) { … } ] hears the raw keyboard regardless of focus. There is no subscription syntax and nothing to unregister: the source is a child, so it lives and dies with the node that declares it.

Members are separated by commas; a trailing one before a closing ] is legal.

A bare name resolves outward through the enclosing brackets, innermost first — the brackets are the scope exactly as they are the tree. Each [ ] you are nested inside is a level whose surface is that node's whole member set, and the nearest level owning the name wins, at compile time. One consequence to hold on to: every view carries the built-in attributes, so a bare width always means this node's width — built-ins never resolve outward.

Three reserved words say it explicitly, and nothing else may take their names: this (the node the code is written on), parent, and app (the running application, from any depth — the home of the few values the whole app shares). Bare App is the class; app is the instance. A fourth, classroot, belongs to authoring a class and arrives in §4.

Reactions
Sign in to react

Discussion

0 comments on Savant Gateway

This discussion is ours, not the publisher's. The thread is public. Sign in to post; the source's own comment count, when reported, appears in the details panel. One level of replies is supported.

Sign in to join the discussion.

No comments yet. Start the conversation.