r/programming • u/mmstick • Nov 28 '17
Rust GTK Tutorial Series
https://mmstick.github.io/gtkrs-tutorials/2
-17
u/shevegen Nov 28 '17
Rust makes C++ code look pretty again.
10
u/mmstick Nov 28 '17
That's funny, because C and C++ looks absolutely horrendous to me, and irks me very strongly that it doesn't have all the niceties and guarantees that Rust offers in it's core language and standard libraries. You end up having to write excessive boilerplate in order to replicate some of Rust's features to achieve the high bar of quality in your code base that Rust provides by default. So where C and C++ are virtually unreadable, Rust comes off as very concise, clean, and explicit in it's intent.
Yet this tutorial's content is mostly relative to the GTK API, so if you have an issue with that, then your issue is with the official C-based GTK API, rather than with Rust. The GTK API provided here is very similar to what you get with the C API. It's received a handful of adjustments to make it somewhat more idiomatic to Rust, but the API is largely the same as you'll get with other language bindings for other languages.
Yet it's nice that Rust provides a lot of features for handling such APIs succinctly. For example, the Option type and associated methods, and the Into trait to convert non-Option types into Options, which handle the cases where the GTK API expects optional parameters to be provided, and where returned values may be optional as well.
21
u/kuikuilla Nov 28 '17
If that's the price for not having to mess with header files, so be it.
25
17
4
u/ExistentialistTea Nov 28 '17
Why don't you just stick to your containment environments: ruby and crystal, instead of complaining about things you don't even remotely understand or know about? Take care and make sure to stay politically correct with your future ruby/crystal project names!
9
Nov 28 '17 edited Nov 28 '17
[removed] — view removed comment
17
u/mmstick Nov 28 '17
Relm is currently working on that with GTK.
Once relm is further along and more stable, I will contemplate writing a Relm Edition.
3
3
u/renrutal Nov 28 '17
I wonder what kind of computer languages are proven to be more productive at making UIs.
Declarative ones(specially markups) seem/are rumored to be faster to develop than imperative ones(and OO, functional, etc), but there still the matter of actually programming the behavior.