Rust, D, GTK+, and asynchronous working

Daniel Kozak kozzi11 at gmail.com
Mon Apr 27 10:02:59 UTC 2020


On Mon, Apr 27, 2020 at 11:56 AM Russel Winder via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:
>
> Hi,
>
> Background: I chose to rewrite a Python/PySide2/Qt application in
> X/GTK+. After much dithering I was pushed to Rust/gtk-rs/GTK+ and set
> to it. Then I decided to do D/GtkD/GTK+ as well.
>
> Totally unscientific, biased, and indeed prejudiced result is that D is
> a nicer programming language to work with than Rust for doing GTK+
> related UIs.
>
> BUT…
>
> Now I have to add the networking.
>
> GTK+ (and therefore both gtk-rs and GtkD) has APIs for all the socket
> stuff so as to be harmonious with the Glib/GIO/GTK way of the world.
> The Big Question™ is how to add monitoring a read socket stream in the
> event loop.
>
> Qt just does it automatically as far as I can tell, but GTK+ appears
> not to. Which is totally bizarre.
>
> Rust now has async/await and futures such that you can create something
> to put on the GTK+ event loop very easily. It also has very nice tools
> for doing "reactive programming" using classic programming constructs
> that turn into event loop manangement with futures.
>
> Does D have anything similar or has it missed the "programming with
> event loops" boat. Currently I am having a hard time finding ways of
> doing what is easy with Rust/gtk-rs/GTK+ using D/GtkD/GTK+ and this is
> rather frustrating given how much nicer D is for working with GTK+ than
> Rust is.
>
>
> --
> Russel.
> ===========================================
> Dr Russel Winder      t: +44 20 7585 2200
> 41 Buckmaster Road    m: +44 7770 465 077
> London SW11 1EN, UK   w: www.russel.org.uk
>

D does not have any builtin async/await but you can use libraries

https://code.dlang.org/packages/vibe-core
https://code.dlang.org/packages/dawait



More information about the Digitalmars-d-learn mailing list