Better HN
topnewbestaskshowjobs

Declare is a UI language for you and your AI(davidtemkin.github.io)

102 points · by ilamont · 20h ago · 87 comments

Comments
saidinesh516h ago
I think Qt/QML really reached hit sweet spot for me when it comes to describing UIs (ignore if any syntax errors, doing this from memory):

For eg. compare this:

``` Window { textColor: "slategray" property int v: 40

    ColumnLayout {
        id: layout
        anchors.fill: parent
        spacing: 20

        Text {
            id: number
            Layout.alignment: Qt.AlignHCenter
            font.pixelSize: 70
            text: v
        }

        ProgressBar {
            id: progressBar
            Layout.alignment: Qt.AlignHCenter
  
            value: v/100
            color: v < 50 ? "dodgerblue" : "turquoise"
        }
    }

    MouseArea {
        anchors.fill: parent
        onClick: v = (v+20)%100
    }
} ```

with Declare:

``` App [ textColor = slategray,

    group: View [ x = center, y = center, width = 80%,
        layout: SimpleLayout [ axis = y, spacing = 20 ],

        number: Text [ width = 100%, textAlign = center,
            fontSize = 70, fontWeight = bold, text = { "" + v } ],

        bar: Gauge [ width = 100%, value = { v },
            tint = { v < 50 ? cool : warm }, accessibilityLabel = "v" ],

        hint: Text [ width = 100%, textAlign = center,
            text = "click anywhere to change v" ]
        ],

    v: number = 40,
    cool: Color = dodgerblue,
    warm: Color = turquoise,

    onClick() { v = (v + 20) % 100 }
    ]
```
ogoffart5h ago
It lives on in Slint. The syntax is inspired to QML, but statically typed and compiled to native code (no JS engine, no browser). Can be used from different programming languages. https://github.com/slint-ui/slint
saidinesh55h ago
I actually used to follow Slint back when we used Qt at $DAY_JOB! I learned quite a bit about compilers looking at your repo back then..
pennomi8h ago
QML was really something special. I’m sad that type of syntax never really caught on in the wider UI world.
demo45678h ago
Yes. I love Qt/QML. Nothing has replaced it for me since. I find android/ios too hard to read, until Jetpack compose came along and even then. Dart is better
andyfilms16h ago
It's so interesting how different frameworks appeal to different kinds of people. For me personally, I regret every second I've ever spent writing glue code. The whole signals/slots paradigm killed my desire to use Qt every time I tried it.
KuhlMensch4h ago
Hm. Its great.

I'm happy enough the with xml-based tsx - if only to differentiate between declared structure v.s. expressions.

Especially (with what I've seen briefly) of Solid v2.

But I'm sure I could get used to the above quick.

0x0736h ago
Sad that it's similar slow and memory hungry like winui (qtwidget app use 10mb => qml 100mb).

Additional to it it may have more fps, but feels less snappy.

I still use it as it's better than electron, but still makes me sad.

saidinesh54h ago
As good as QML / QtQuick is, I feel like it makes it very easy to create slower applications by creating too many objects, and too many property bindings.. A lot of QtQuick widget libraries made all kinds of mistakes and you end up really sluggish desktop applications.. even though - the fps counter shows 60 fps..

But I have also seen really well optimized QtQuick applications that ran at 60 fps on a single core imx6 while playing video, applying all kinds of effects on the video...

abrookewood16h ago
The LLM language is pretty off putting: "Say what you mean. Exactly" and then in the code comments "// One value, v, and three things that follow it". It's such an awful way of writing.
ShinyLeftPad9h ago
It's so out of place in open source. I hope people get fed up with this marketingspeak soon and straight old-school websites get trendy again.
triyambakam15h ago
Yes, it's definitely Claude and so dumb. More GPT models seem to do this less. But unfortunately Claude is just otherwise so much better lately.
Syzygies7h ago
I managed to train my agents to comment in my style. It was hard work; one has to stay on it. Judge here the human's lack of effort, not the untrained dog.

The hardest similar problem I've faced was teaching agents aesthetics for a drawing style. What worked: I hand-engineered an interpretable feature space for SVG diagrams, and used the feature vectors of exemplars as the style target for generation. The agents then wrote code one-shot that drew as I liked.

AI is a kit, not a car where you turn the key. We're all facing the same issues, and many of us are constantly engineering infrastructure to "fix" AI to our needs. Consensus forms fast, and much of this engineering becomes available out of the box if one instead just waits a few months. Reification of state between sessions is the big one we all used to do by hand, that's now standardized.

Feature spaces would work for teaching comment and writing styles. Try it!

pavel_lishin5h ago
It sounds like you changed your style to sound more like AI.
dallen337h ago
Bro this sounds like AI.
Syzygies1h ago
These are the correct terms for the math, and the same math is behind AI.

Before I fixed my language, my original was "A key component of LLMs is a semantic embedding into a large vector space. I struggled with teaching LLMs aesthetic judgement, and what worked was building hundreds of sensors to measure aspects of an SVG diagram, and embed art that I liked into a corresponding vector space. Then I could tell an LLM coding agent "draw like this!" and it could, one-shot."

frizkie6h ago
You don’t say
mattbettinson7h ago
I call them "corporate mic drop moments". It's punctuated like that at the end of every paragraph and its so grating
bensyverson9h ago
I wish I had a name for the "One value, and three things that follow it" construction. I think the model feels it's being dramatic, but it's borderline nonsense.

"Two vectors, and the one invariant that binds them." WHAT ARE YOU TALKING ABOUT

topicalSoup8h ago
There actually is a name for this: “mannered prose”. It’s terrible.
bensyverson6h ago
That's the umbrella term, but I want a name for "seventeen of them, and two are never true"… As if the model has to pay for nouns.
qingcharles4h ago
One invariant to rule them all, and in the darkness bind them.
mapcars8h ago
Not sure how it supposed to be used. Its a whole new language with its own constructs and rules, no training data for LLMs to use it well, syntax is questionable, and as much as it tries to stay declarative its already clear that it can't: onClick() { v = (v + 20) % 100 }

At this point I don't see any pros compared to any existing reactive framework.

hungryhobbit5h ago
Exactly, to any React dev JSX is much clearer than this.
TonyAlicea109h ago
It's extraordinary to me how many people are ok with having horrific Claudish fill the landing pages for their projects.

For now, I would urge project creators to start using Neon for writing docs and landing pages. It's significantly better out of the box.

hasbot9h ago
For those that don't know, "Neon" refers to "Gemini 4 Neon." https://blog.google/innovation-and-ai/models-and-research/ge...
talmr6h ago
As soon as I see that I just quit the tab.

I don’t think it is worth giving my agent to peruse either, because it will get poisoned.

Hard skip. And maybe even block.

stronglikedan5h ago
> As soon as I see that I just quit the tab.

Claude has ruined Solarized for me. As soon as I see that theme (light or dark), I quit the tab. I don't even need to start reading.

talmr4h ago
Ha! I have used solarized theme since I was a kid, for my editors, terminals, even my OS theme.

I am making some software currently which has a solarized background but white containers on top.

The claude solarized + burnt orange is quite unpleasant, however.

ricardobeat8h ago
Absolutely, just used Neon to rewrite a ton of comments and docs and they are so much better. Neon + diataxis [1] produced documentation indistinguishable from human writing.

Meanwhile, Claude has become immune to skills that try to tame its writing style. I think they’re prioritizing preventing distillation vs their own product UX, which is a shame.

[1] https://diataxis.fr/

mamcx6h ago
how combine with diataxis?
qingcharles4h ago
+1 for Neon. Its writing is a step above the others. It's still AI, but it's better AI.
mtford17h ago
First contact marketing pages and core documentation should be written by a human. This sounded interesting but my eyes glazed over as soon as I detected the AI smell...
altern815h ago
Same here. They couldn't be bothered to write a couple of pages of text..?
iamflimflam113h ago
It’s amazingly difficult for people to throw away AI generated text and redo it. I think we still feel sunk cost even when there isn’t any.
bombdailer5h ago
It's more that AI writing poisons the brain and prevents the flexion of ones own judgment and creativity. It forms a kind of foundation which is difficult to throw away since it biases your thoughts towards the AI prose, and because people put so little comparative effort into anything created with AI, they do not feel the sense of ownership and accomplishment that comes from having created something themselves, so the effort required to rework the prose is too great for atrophied minds.

If one starts with AI text, it is like seeding their mind with already completed details, and so they cannot see anything beyond the pre-existing structure it has created for them. One has to start from a blank slate to avoid this fate.

cyanydeez11h ago
Is it sunk cost or the dreaded realization your product will never be consumed by humans. At best, it'll be a LLM mediated inspection. Why then would you want to speak to this supposed human when Claude is both the reader and writer.

Anyway, it's probably more existential dread than laziness. Y'all just gonna point your LLM at it in real world use.

samrus16h ago
The claudish here got unreadable after a while. The project's thesis really should be written by a human. Shame becuase it seems like an interesting idea
skybrian17h ago
This looks quite nicely done. I'm reluctant to try it solely because the website has so much marketing-style writing (probably AI-generated) and I'm not sure I want to read more of it.

It should probably say up front that this is an npm package along with the tooling for it, and the output runs in a browser.

onemoresoop16h ago
There's a disclaimer of sorts right on this webpage:

"This page is written in it. By an LLM."

lopatin14h ago
It’s not about whether or not it was disclosed. It’s the lack of effort and craftsmanship which gives it away as something not worth our time if the authors themselves didn’t put their time in.
davidtemkin4h ago
(project builder here) I'll own up to the marketing-y prose on the homepage. Lesson learned. And yes there is AI prose / locution / diction there. Apologies.

But, there's a lot of actual craftsmanship in the project. (Or at least it's taken real work and thinking over a long period of time; you be the judge).

Do take a look at the FAQ, and "Why" under "Learn", you might find things you like. And the calendar example too.

I fell into a bit of a trap on the prose, which is ironic considering I've edited actual publications and been a journalist... years ago

davidtemkin4h ago
Ok this is my project.

Appreciate the reactions - and ahem , point very much taken on marketing-y prose and admittedly (some) AI prose diction in sections. Bad on me.

All that being said there is actual depth here, it’s not a thin layer over React. Even if you have no interest in agent-driven coding - but are interested in front end dev - I think you’ll find some interesting bits. The language and framework allow a lot in the way of design expressiveness without escape hatches. The component library is self-hosted. Animation built on fine grained constraints. Accessibility. Runs on DOM or without DOM.

And yes it is typed.

Btw if you happen to remember a language / framework called OpenLaszlo … from many years back — this is a sort of successor. I co-founded the company that created that project.

cryptos14h ago
I like the idea somewhat, however, I have the vague feeling that it is not really simpler than actual UI frameworks like Vue.js or Compose[1]. My assumption is that a real framework is even better for AI.

[1] https://kotlinlang.org/docs/multiplatform/compose-multiplatf...

KolibriFly13h ago
Real frameworks also give Ai agents a massive advantage in tooling - mature typecheckers, linters, and test runners. When an agent edits Compose or TypeScript React, it gets super clear feedback loops to self-correct, which is hard to match in a brand-new DSL

Honestly, Jetpack Compose and SwiftUI already nailed concise declarative UI, and they have the huge advantage of living inside full-blown languages like Kotlin and Swift so you don't hit a wall when logic gets complex

davidtemkin4h ago
The language and tools here are very much adapted to LLMs. The error messages, the verification process, etc -- all optimized for AI use. It's counterintuitive but having a language that an LLM learns from context vs pre-training has some advantages. The language itself was shaped by watching the evals and where it broke.

A more closed language would be even more effective on this dimension but I didn't want to give up expressiveness / ability to make truly custom UX. That's been a big part of this project...

(this is my project...)

silok14h ago
Looks very related to A2UI Express, https://developers.googleblog.com/fast-reliable-a2ui/ as well as OpenUI https://www.openui.com/docs/openui-lang/specification
davidtemkin4h ago
Related. This one is more geared toward open-ended fine-grained custom design...
owebmaster12h ago
Never heard of a2ui from Google. That's great! (The fact that it got ignored just like A2A).
GrollingGrakbor14h ago
Looks vaguely interesting. Unfortunately I had to stop reading after 1 minute.
piterrro15h ago
Interesting project, few ideas on the landing page:

- Move docs to llms.txt too

- Make one click copy prompt button for starting with an agent

- Explain clearly how it can integrate with React or Vue - if I can embed a module in my already existing app - thats a great way to transition over time.

- Play the “Agent” card more - these days nobody will learn new DLL, but having a way to quickly test it with my agent would convince more people to give it a try

davidtemkin4h ago
Thanks - I will do this
joddystreet17h ago
I was working on a similar concept - Morpheus

Snippet -

```

document ::= ( comment | blank )* screen-line body

body ::= ( element-line | comment | blank )*

element-line ::= indent kind [ name ] meaning* [ modifiers ]

```

joddystreet16h ago
This was take 2

```

document = { template } ;

template = "@template", identifier, newline, { node }, "@end", line-end ;

node = group | row ;

group = "<", identifier, ">", newline, { node }, "</", identifier, ">", line-end ;

row = atom, { "|", atom }, line-end ;

atom = reference | component | spacer ;

reference = "[[", identifier, "]]" ;

component = "[", label, [ "|", identifier, { "|", property } ], "]" ;

property = identifier, "=", value ;

value = json-scalar | binding ;

label = label-part, { label-part } ;

label-part = literal-text | escape | binding ;

binding = "{", identifier, { ".", identifier }, "}" ;

spacer = "..." ;

line-end = newline | end-of-file ;

```

Still evolving.

Core idea is to be able to define interfaces in a minimal language, without going into too much details about attributes, say height, width, etc

verdverm17h ago
Myself too, they are all essentially DSLs with a transpiler to underlying tools and packages in a given language. Mine is different by allowing module developers to control the output technologies and DSL if they want, boiled down to CUE + text/template. Downstream users get a similar experience to this post.
joddystreet16h ago
You might find these interesting -

- https://github.com/stencil-hq/slab

- https://github.com/expo/exact

verdverm1h ago
Both of those are too much DSL (imo). My approach involved no business logic, because that never works out, and focussed on generating/maintaining boilerplate, while also allowing users to modify the generated code and have it survive regen (diff3)

https://hofstadter.io/code-generation/

I'm migrating / renaming / cleaning up the project this week

https://github.com/verdverm/veg

joddystreet16h ago
My focus was essentially to be able to define this and let agents use these to build the interfaces. This `...with a transpiler to underlying tools and packages in a given language.` is an interesting idea, but I just want to focus on the language specs and compiler.
verdverm1h ago
> but I just want to focus on the language specs and compiler

I'm using "a transpiler" loosely to cover when the input is a DSL and output is something like react, tanstack, node - but tech choices are flexible here

fleur-de-lotus16h ago
Can this be used as a front-end to an app written in another language or can it call code written in another language?
agnishom17h ago
What has this got to do with AI? I like declarative frameworks, but why is this one special for AI?
chr15m14h ago
If you think this looks good, you should see Hiccup and Reagent.
moralcoral15h ago
Hyperscript ... anyone?
dudhatprakash998h ago
Ah another language!!! By this time, AI already trained on billions of line of javascript code for UI. so this language have to compete with that knowledge base. It'll be really exciting to see how quickly AI agents can build the UI for same problem using `Declare` as compared to any javascript framework (React).
sroerick14h ago
This seems very well executed and solves a ton of the problems I've seen in UI with agents so far.
HexDump08h ago
Not to hate, but I feel like we are just reinventing the "slop" wheel. LLMs are already pretty good that they don't need another "Language for AI" limiting them
DeathArrow16h ago
>Just as SQL is a domain-specific language for database queries, Declare is a DSL for user interfaces

Isn't HTML a DSL for UI? What's wrong with it?

voiper114h ago
This is an abstraction, like any other library/front end is one layer up on HTML.
mejutoco15h ago
It is not typed
zaphirplane16h ago
there must be a reason there are so many css libraries and UI frameworks
Noamc040515h ago
interesting. What can it do?
mllev1516h ago
It’s REBOL for the web. This is what you get when you don’t realize what your LLM is ripping off.
designerarvid16h ago
When are those switches in the tutorial on or off? And what do they do?

“Show boxes”?

UI used to strive for making it easy for users to understand the software’s mental model, current state, and possible actions. Now it’s about looking cool (the same as the other cool kids).

koteelok17h ago
Next time you try to build a UI tech, make sure your site isn't ugly.
mysterydip7h ago
I find the copyright notice at the bottom of the page particularly humorous given the page itself states it was all written by an LLM
efskap15h ago
The cursed green claude dot is now following my cursor for pete's sake
rogual15h ago
What even is that thing? I can't figure out what stylistic or functional purpose it's supposed to serve.
cobbal6h ago
Before it was the claude dot, it was commonly seen on "Live" indicators for video streams and other real-time information. It indicated an active connection to some sort of server. That's my guess where it came from, and then it got RLHF'd into overuse because who wouldn't want their website to be more dynamic and real-time?
jauntywundrkind15h ago
Heximal looking very interesting on this front. A DOM-ish like system but wasm-driven, wasm-homed. Already virtualized out of the real dom.
etchalon15h ago
I just have a hard time with anyone who thinks you can make good UIs this way. "Declarative" UI has been tried, multiple times. It does not produce interesting UIs. It produces derivative, limited UIs that require deeply weird hacks to handle novel problems.

XAML was a notoriously bad idea.

This doesn't look much better than that.

altern815h ago
Site looks pretty bad, with the classic AI gradients and 01, 02, 03 lists.

Language is extremely annoying.

I hate it

mehmetkose14h ago
Anything related with UI makes me expect more than a slop look
zobzu18h ago
neat
boxed16h ago
It's not a UI language though, it's a typescript specific tooling system?

Declare — a UI language for you and your AI

Designed from the ground up for interfaces that act and move like the best native apps, in a few hundred lines your AI can write and its compiler can check.

Declare