HaikUI: A SwiftUI‑Inspired DSL for Haiku OS

6 Likes

Would you mind elaborating beyond just posting a link? What do you want to show or discuss?

1 Like

I like the idea. Reminds me a bit of Tcl.

Did you read the article? Is all there!

2 Likes

Is this your work, and is there a repo somewhere (don’t see one in the article)? I love SwiftUI and genuinely think it’s one of the best systems for concisely and clearly building out UIs there is, so this is almost an awesome ‘worlds colliding’ moment for me

Yes, and? Are you the author? Is this some third party comparison of a project?

I might be wrong, but it looks to me like an AI generated article describing just a concept without the actual implementation.

1 Like

The repo seems to be at GitHub - lildinti/SK_Projects .
It, currently, only contains a readme file.

It’s a compelling idea nonetheless. I hope to see it take shape soon.

I’m curious to this point, the “comparison” not mentioning the layout kit at all is super strange, especially considering that the layout kit does more things “like swiftui” than the proposed thing does

2 Likes

Thank you all for the kind words and interest. I’m the architect/developer and is currently WIP but in very advanced state. The yab version is completed and being tested. There’s a C++version in the making that it can generate c++code while the yab one can generate both yab and c++code, including event handlling stubs. Will keep you posted as project progress. Happy coding!

1 Like

For us common folk, what is DSL?

I am not familiar with that acronym.

DSL = Domain-Specific Language.

A language made for describe a specific domain of computer sciences.

YAB being, AFAIK, already Haiku oriented, why addopting a SwiftUI approach but via an intermediate DSL step instead of the built-in Haiku’s LayoutKit, which in fact is even more like SwiftUI ?

Wouldn’t more logical to expose in YAB the LayoutKit, simply?

1 Like

I also had similar idea with implementing Haiku support for React Native. So you can write Haiku GUI applications in JavaScript using native Haiku controls and layout kit via React component tree. It allow rapid and easy GUI application making compared to C++ and familiar to many developers.

Something like this, but for HaikuAPI: GitHub - gtkx-org/gtkx: Build native GTK4 desktop apps with React and TypeScript

2 Likes

If I understand this correctly, it enforces a bit of structure on yab coding. Consider the following (Pseudocode, not real yab)

window create … MainWindow$
    View Create view1$
        Widget create widget1a$
        Widget create widget1b$
    View Create view2$
        Widget create widget2a$
        Widget create widget2b$ 

Clearly that is the way things should be done. But ATM yab will accept the following as perfectly valid code.

window create … MainWindow$
View Create view1$
View Create view2$
Widget create widget1b$
Widget create widget2a$
Widget create widget1a$
Widget create widget2b$ 

So if I understand this proposal correctly it will enforce a more structured approach to yab UI building. A bit like Yoshi, perhaps? Don’t worry, the old Wild West approach will still be there too.

When I’ve made foreign function interfaces to the Be/Haiku API for other languages, just off the top of my head, some issues:

  • protecting language runtime from concurrent access from window threads
  • translating C/C++ calling conventions - like turning output parameters to function return
  • renaming overloaded member functions
  • setting up user callback functions out of C++ from something like a vtable

I know nothing about Yab, but seems possible that different UI instead of the native API could work around some of these.

Yab already has native ui bindings and had for years. So I assume it already solved all those problems.

2 Likes

Very roughly how much coverage? To ask a terrible question. I tend to lose interest around 2,000 functions, and there’s a big hole in the UI features - I forgot one of the issues, the one I haven’t dealt with at all:

  • support for more recent C++ features such as in the layout kit, that can’t be accessed with C wrappers with callbacks.

I’m not sure what you mean by “more recent”, the layout kit is built with C++98 as anything else in Haiku.

The generic BLayoutBuilder uses templates, which are entirely compile time. So that part doesn’t translate well to other languages, or at least it needs to be re-done in their native compile-time system if they have one.

But you could use the alternative BGroupLayoutBuilder, BGridLayoutBuilder, etc family of classes, or create the layout objects (BGridLayout, BGroupLayout, …) directly without using any builder. The BLayoutBuilder is here only to provide a pseudo-declarative syntax on top of that, and since it’s all about syntax, it makes little sense to try to bind it to another language with a different syntax?

Thanks, from a very casual read that does look like a possibility. Of course by “more recent”, I mean relative to the original Be API that Haiku implements.