|
|
Subscribe / Log in / New account

I can't understand the logic for this

I can't understand the logic for this

Posted Aug 15, 2024 19:01 UTC (Thu) by yeltsin (guest, #171611)
In reply to: I can't understand the logic for this by jengelh
Parent article: COSMIC desktop makes its debut

And then, on top of said imperative foundation, people invent and widely use libraries/frameworks like React that provide a (not purely) declarative model for describing the user interface (or more precisely, for deriving the user interface from the underlying data). Because the imperative model is so difficult to work with in large applications. We've come full circle.


to post comments

I can't understand the logic for this

Posted Aug 19, 2024 5:04 UTC (Mon) by ssmith32 (subscriber, #72404) [Link]

I know you said not "purely".. but..

React is not a declarative model, even moderately. Maybe slightly if you squint really hard after too many drinks? But it's mostly *not* declarative.

It's very much an imperative language that lets you build components.. similar to how most object-oriented UI frameworks work. If you stretch the definition of declarative enough, maybe? But then GTK would be considered declarative...

But you very much tell it to

Build component A,
then connect it to component B,
when you get signal X, then update Y, etc.

Step by step, in an imperative fashion.

Having abstractions and components != declarative.

SQL is probably the closest thing to declarative that most folks are familiar, and it's nothing like building a React app, and is absolutely *atrocious* for building large apps out of. Large SQL queries are usually much less maintainable than code of any sort of a similar size.

Prolog is also much closer to declarative than React. And is also absolutely horrible for large programs.

A declarative language for UIs would let you declare what you want to accomplish, literally, something like: "A UI to let me update the time and timezone on COSMIC"... and then the optimizer goes off and builds that UI.

React, you have to tell it exactly what you want, and, most importantly, how to handle input, step by step. That's imperative.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds