Live data from Hacker News

Show HN: Async UI: A Rust UI Library Where Everything is a Future

wishawa.github.io

61–70 of 96 posts

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#61
post #41

Earlier quoted context omitted.

Why would people want to build a UI in Rust except for speed? Memory safety doesn't seem super important in the UI context. There is a reason most people still refer to Rust as a "systems" language.

> Why would people want to build a UI in Rust except for speed? Lots of reasons. * The developer is familiar with Rust. * The rest of the project is written in Rust. * The primary function of the app is something for which a library exists in Rust. Sure, Rust is known for running fast and for memory safety. But that doesn't mean that it will never be used except for those two reasons.

Yup. I write all my UI's in Rust. I write, well, everything in Rust. Why? Because i prefer it, and there is no task that i feel is fundamentally hindered by Rust itself. Shortcomings in libraries can definitely hinder, but that gets better with each year.

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#62
post #16

You might be interested in RUI https://github.com/audulus/rui

RUI is really cool, but it is solving a different problem. It is immediate-mode, and it is focused on building a new toolkit. Async UI is more about re-exposing existing retained-mode toolkits in nice-to-use, Rust-friendly APIs. The cool thing is this: with some effort, it is probably possible to adapt the two library together to have a UI with RUI's rendering system and Async UI's APIs.

In a similar vein, what do you think of Druid? I’ve enjoyed using it in the past.

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#63
post #2

Hi HN! I've been working on Async UI for half a year now, and I think it is time I share it with everyone. The project is not even really usable yet (due to lack of implemented components and documentation), but I think the proof-of-concept is enough to demonstrate this new way of doing UI — a way that, I believe, is more suitable to Rust than existing UI framework designs. P.S. My website is new, so if you find any…

I really like what I see so far, especially the out of the box focus on web as well as desktop. That's absolutely killer.

One thing to not neglect is accessibility. Even if it's not fully baked yet giving it some thought in the API and implementing for web would be a big plus. Accessibility is the hill most non-mainstream UI toolkits die on. They usually leave it for later and then find that it's hard because they didn't think about it.

Being retained mode puts you ahead in the accessibility game right away.

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#64

(Context: I write async rust professionally) Fly you fools. This will be a nightmare to debug, introspect and reason about for a speed boost that you (and your users) won’t be able to measure. If you want to build a native app, more power to you. There are simpler languages that will enable you to do that with a much higher productivity. Kudos to the library writer though!

+100

It's time for us to take the institution back from the lunatics.

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#65
post #27

Earlier quoted context omitted.

> The point of async APIs is not speed boost, ... I think the parent comment meant using Rust rather than a garbage collected language like C# or even Java for a GUI. Not just using async within Rust.

Java GUIs are horribly slow. Maybe it's not inherent but I've never encountered one that wasn't. C# ones are sometimes alright but only if they're using the native Windows frameworks.

Like IntelliJ?

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#66

Earlier quoted context omitted.

The point of async APIs is not speed boost, it's decoupling processing from the local call stack (which happens to hang up the GUI until the routine resolves, but also forces components to be tightly coupled and monolithic). IMO every end-user-facing interface should be based on async calls, which provides better composability and forces the developer to think the relations between all full possible interactions and…

> The point of async APIs is not speed boost, it's decoupling processing from the local call stack You can do the same with goroutines/green threads/virtual threads, without putting the burden of differentiation between sync and async functions on the programmer. The only argument for async/await syntax I've ever seen is either "it allows traditionally sync languages to use async" (compatibility) or "it gives the com…

> You can do the same with goroutines/green threads/virtual threads

goroutines capture a lot more state than an async continuation/future. The same argument you made below against OS threads applies here too.

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#67

Seems a weird mix of async and callbacks spaghetti. I´d expect an async UI to be in "immediate UI" style, e.g.: async fn give_em_cookies(window:Win) { win.title("Cookies!"); win.columnwise(); win.label("Which cookie do you like?"); let cookie = win.selector(&["Shortbread", "Chocolate chip"]).await; win.label("When to you want to eat the cookie?"); win.rowwise(); if win.button("Now!").await { eat_cookie_now(cookie); }…

[deleted]

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#68

Earlier quoted context omitted.

The point of async APIs is not speed boost, it's decoupling processing from the local call stack (which happens to hang up the GUI until the routine resolves, but also forces components to be tightly coupled and monolithic). IMO every end-user-facing interface should be based on async calls, which provides better composability and forces the developer to think the relations between all full possible interactions and…

> The point of async APIs is not speed boost, it's decoupling processing from the local call stack You can do the same with goroutines/green threads/virtual threads, without putting the burden of differentiation between sync and async functions on the programmer. The only argument for async/await syntax I've ever seen is either "it allows traditionally sync languages to use async" (compatibility) or "it gives the com…

I second this, as personally I believe that async is an anti-pattern. It's an unfortunate result of the programming world choosing easy over simple so it could recruit vast armies of inexperienced programmers for profit:

"Simple Made Easy" by Rich Hickey: https://www.youtube.com/watch?v=LKtk3HCgTa8

I'm old school, I want the runtime to do as much work for me as possible so I don't have to. Basically that looks like the runtime providing things like process isolation and concurrency, even if the underlying hardware can't do that. Especially if we're using a high-level scripting language like Javascript anyway. Rust I could maybe see at least providing access to async functionality, but I'd vote specifically against that footgun and go with lightweight threads and message passing (how Go does it) or scatter-gather arrays (there may be a better term for this) with the compiler detecting side effects and auto-parallizing everything else like loops. The simplest way to facilitate that is to use immutable data as much as possible, passed via copy-on-write (the Unix way).

The idea of async being scattered around operating systems and kernels and such is anathema to my psyche. Code smells setting off my spidey sense everywhere I look. To the point where if the world goes that route, I just don't think we'll have determinism anymore. That makes me want to get out of programming.

Note that I feel the same dismay about stuff like the DSP approach used by video cards, where the developer has to manually manage vertex buffers, rather than having the runtime provide a random-access interface. Not being able to make system calls from shaders is also tragic IMHO. We've lost so much conceptual correctness in the name of performance that it breaks my heart. The cost of that is the loss of alternatives like genetic algorithms, which could have provided a much simple roadmap to get to the inflection point we're at with AI, 20+ years ago.

It all just makes me so tired that I feel like some guy yelling at clouds now.

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#69

Earlier quoted context omitted.

> The point of async APIs is not speed boost, it's decoupling processing from the local call stack You can do the same with goroutines/green threads/virtual threads, without putting the burden of differentiation between sync and async functions on the programmer. The only argument for async/await syntax I've ever seen is either "it allows traditionally sync languages to use async" (compatibility) or "it gives the com…

> You can do the same with goroutines/green threads/virtual threads goroutines capture a lot more state than an async continuation/future. The same argument you made below against OS threads applies here too.

What state does a userspace thread have to capture in order to work that a coroutine doesn't?

Re: Show HN: Async UI: A Rust UI Library Where Everything is a Future

#70
This is an interesting idea, but if you look at bigger examples, such as the todo-list example, the code is littered with `async` noise, calls to `borrow()`, and other fancy stuff like reducers. (A todo list is easily expressed in SwiftUI without much ceremony) Seems like scaling up to actual apps would be a mess.

https://github.com/wishawa/async_ui/blob/main/examples/web-t...

Post reply on HN