Hacker News new | past | comments | ask | show | jobs | submit login

Nice, I really enjoyed Flutter's approach to building UI, but I didn't really care for Dart all that much.

In theory shouldn't it be possible to create a programming language specifically for UI? Something that can be interfaced with from any major programming language. Kinda like protobuf with its IDL format, but instead of defining data, it's declaring user interfaces. Is that a crazy or stupid idea?

QT and XAML come to mind, but I believe QT is closed source (might be wrong about that), and XAML seems to have been dead in the water for a long time now (also might be wrong about that).




Qt has some commercial license only components, but the majority is open-source. In fact, the KDE Free Qt Foundation ensures that the framework is always available under GPL+LGPLv3.[0]

Anyway, there are some languages specifically desgined for making UIs. Qt has one of those, QML[1]. It's a "simple" language made precisely for UI development, that can be wired to C++, allowing you to write business logic in a general language, while keeping UI focused.

More interestingly, though, is Slint[2]. The language (and company behind it) was made by ex-QML devs which sought to improve the design, avoiding some pitfalls that QML ended up running into. It's core is written in Rust, but there are bindings for C++, JS and now Python too. They also have a focus on embedded devices, which ends up translating to always having good performance and memory footprint in mind, which is neat.

One of Slint's dev is ogoffart: https://news.ycombinator.com/user?id=ogoffart

[0]: https://www.qt.io/faq/tag/qt-open-source-licensing [1]: https://en.wikipedia.org/wiki/QML [2]: https://slint.dev


Wow slint is almost exactly what I was imagining, thanks!


XAML is very much alive within Avalonia[0], Uno[1] and MAUI[2] (not to mention WPF) :)

There is support and growing popularity for declarative UI defined in C#[3] and F#[4] instead though.

[0]: https://docs.avaloniaui.net/docs/basics/user-interface/intro...

[1]: https://platform.uno/docs/articles/getting-started/counterap...

[2]: https://learn.microsoft.com/en-us/dotnet/maui/xaml/fundament...

[3]: https://github.com/AvaloniaUI/Avalonia.Markup.Declarative

[4]: https://github.com/fsprojects/Avalonia.FuncUI


Interesting!


I’m curious what you don’t like about Dart? I thought I wouldn’t like it but I’ve found it surprisingly nice.


Off the top of my head:

1) Types on the left

2) Statement, not expression, based

3) No privacy modifiers (aka, underscores everywhere)

4) required semicolons

5) no language support for json (de)serialization, or, json boilerplate everywhere (yikes)

I've tried to get into Flutter 3x now, and each time Dart has defeated me.

Flutter is quite good though, so take the good with the bad, I just can't stomach Dart (yet).


I've used lots of languages and those are fairly minor things. For example, I use Rust as well as Dart and just, "types on the left" is seriously an issue? In Dart 3 as well, many statements are now expressions, like switch and if/else, and in some cases, for. For something like JSON serde, Dart will have it soon via macros [0], just like Rust's serde macros. Sounds like you just need to build something you want to build and you'll get used to the language naturally. For me, the utility of Flutter and making cross platform apps outweighs Dart, and anyway, it is quite nice now with Dart 3.

[0] https://dart.dev/language/macros#use-the-macro


I don't have any well-considered opinions about it, moreso that on a gut level it felt like java or c#. It was a while ago that I tried it, and I can't recall the exact details.


you mean CSS?


Kind of, but CSS is only 1/2 of a UI language, and it’s specific to the web.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: