News for hackers. Stuff that matters.
Re:Rust in 2018: easier to use by pjmlp on Sunday January 14, 2018 @04:21AM (#16143451)
Neither I think Rust is fit for that purpose, any GC language is a better fit in terms of productivity, unless we are speaking about tiny IoT devices with a few KBs.

Also, it is not yet fit for writing GUI code. It is quite far from what is possible to achieve today in Qt/WPF/Cocoa/Android/... tooling and even the latest NLL improvements don't fix all issues regarding writing callbacks.

Re:Rust in 2018: easier to use by vkjv on Sunday January 14, 2018 @10:00AM (#16144489)
Thanks to Rust's great C interoperability, hybrid can be a great approach. I've really been enjoying re-writing sections of node.js applications in Rust. It fits fairly seamlessly and can really broaden the scope of what is possible.

https://github.com/neon-bindings/neon

Re:Rust in 2018: easier to use by vhakulinen on Sunday January 14, 2018 @04:46AM (#16143518)
Writing GUI with rust is totally possible: http://gtk-rs.org/
Re:Rust in 2018: easier to use by pjmlp on Sunday January 14, 2018 @06:34AM (#16143827)
It is possible, but far from productive, which I learned exactly by trying to use Gtk-rs to port an old basic Gtkmm demo, that I used for a C/C++ Users Journal article.
Re:Rust in 2018: easier to use by amelius on Sunday January 14, 2018 @07:25AM (#16143971)
Wasn't Rust invented to write a GUI? A webbrowser can be regarded as a kind of GUI.
Re:Rust in 2018: easier to use by foldr on Sunday January 14, 2018 @07:33AM (#16143998)
There aren't any good GUI libraries available for Rust at the moment. GUI libraries are huge and take an enormous amount of work to get right. It's typically only the most popular three or four languages at any given point in time that have satisfactory GUI libraries. Rust has the additional burden that it is far from trivial to wrap Gtk, Qt or other C/C++ toolkits in a safe manner.
Re:Rust in 2018: easier to use by amelius on Sunday January 14, 2018 @07:43AM (#16144030)
Didn't Mozilla write a GUI library before they wrote Firefox? It would strike me as odd if they didn't.
Re:Rust in 2018: easier to use by foldr on Sunday January 14, 2018 @07:46AM (#16144039)
There is no mature GUI library for Rust that I'm aware of. I believe the servo project is focused on writing a browser rendering engine, not a browser GUI. It certainly has not so far yielded a GUI toolkit that can be straightforwardly used in other projects.
Re:Rust in 2018: easier to use by coldtea on Sunday January 14, 2018 @09:32AM (#16144378)
No, it was invented to write a generic (web) rendering engine.

So, even if we consider a web app as a GUI, Rust wasn't invented for writing that (you still use CSS, HTML, JS etc for that part). It was invented for writing the backend for that UI.

In other words, Rust is not GTK (a UI library), it's C (the language the UI library itself is written in).

Re:Rust in 2018: easier to use by amelius on Sunday January 14, 2018 @11:19AM (#16144850)
Ok what is the GUI of Firefox written in/using?
Re:Rust in 2018: easier to use by coldtea on Sunday January 14, 2018 @11:31AM (#16144888)
Until recently-ish something called XUL, a markup language for UI (similar to HTML, or even better XAML). Not sure if they've moved on since.

https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL

Re:Rust in 2018: easier to use by lima on Sunday January 14, 2018 @07:57AM (#16144067)
Rust was invented for low-level parsing/rendering code. The high level GUI in Firefox is not implemented in Rust for all I know.
Re:Rust in 2018: easier to use by StavrosK on Sunday January 14, 2018 @05:55AM (#16143711)
Yes but "possible" and "pleasant" are very different :(
Re:Rust in 2018: easier to use by v_lisivka on Sunday January 14, 2018 @10:26AM (#16144604)
gtk-rs needs a macro package to parse a HTML or a XML snippet and generate GUI, with embedded rust code in appropriate place. Look at Yew for example: https://users.rust-lang.org/t/yew-a-framework-for-client-sid... .
Re:Rust in 2018: easier to use by coldtea on Sunday January 14, 2018 @09:30AM (#16144366)
Yeah, but the parent point is that "possible" is a very low bar.
Re:Rust in 2018: easier to use by chmln on Sunday January 14, 2018 @09:38AM (#16144407)
> Neither I think Rust is fit for that purpose, any GC language is a better fit in terms of productivity

There is nothing in Rust that makes it inherently unfit for APIs or the web. To dismiss the entire language is simply lazy. Having GC also doesn't necessarily make one language superior to another.

While http ecosystem is still in active development, if there was really a choice between Rust and JS for e.g. writing an API I would go with Rust in a heartbeat.

Re:Rust in 2018: easier to use by pjmlp on Sunday January 14, 2018 @10:41AM (#16144673)
The thing is, the choice isn't between Rust and JavaScript, rather between Rust and a list of other languages.

Having a GC means having easier ergonomics to write data structures and distributed algorithms.

I do like a lot Rust's type system, just the ergonimcs aren't quite there yet.

Re:Rust in 2018: easier to use by chmln on Sunday January 14, 2018 @05:40PM (#16146940)
> just the ergonimcs aren't quite there yet

You're correct, but "Rust isn't easy to use for purpose X just yet" is substantially different from "Rust is inherently unfit for X"

Re:Rust in 2018: easier to use by Thaxll on Sunday January 14, 2018 @11:26AM (#16144871)
Except it takes 10x time to write anything backend related. Why would you choose Rust over Java / C# / Go ect ...?
Re:Rust in 2018: easier to use by pimeys on Sunday January 14, 2018 @02:00PM (#16145645)
I don't buy this claim. I've written many services with Rust and I'm not slower with it that I am with GC'd languages I also need in my work, such as Clojure, Scala or Python.

Please explain me where is this idea of slow development time coming from? Is it only because people try Rust for two weeks, cannot get the lifetimes and decide the development speed is slow?

Re:Rust in 2018: easier to use by computerphage on Sunday January 14, 2018 @11:49AM (#16144959)
Except that number is completely made up. Why do believe it takes ten times as long?
Re:Rust in 2018: easier to use by Thaxll on Sunday January 14, 2018 @11:53AM (#16144977)
What Rust framework replace Java spring or equivalent, none of them so you have to write everything yourself. Rust doesn't have any ecosystem to write service side services so you're going to spend time by just re implementing a framework.
Re:Rust in 2018: easier to use by steveklabnik on Sunday January 14, 2018 @02:47PM (#16145941)
While Rust doesn't have many full-stack frameworks, many ecosystems don't favor full-stack frameworks. Rust has tons (arguably too many!) microframeworks/libraries.

I do agree that there are holes, and that's part of being a young ecosystem, but I think you're being a bit too pessimistic. I understand this deeply, as I was once too! As things have evolved, my opinions have changed, though.

Re:Rust in 2018: easier to use by viraptor on Sunday January 14, 2018 @05:09AM (#16143575)
> any GC language is a better fit in terms of productivity

But that's not the only constraint. If you want to save memory, due to the environment you run on, or your workload, a non-GC runtime can be pretty awesome.

Re:Rust in 2018: easier to use by pjmlp on Sunday January 14, 2018 @06:51AM (#16143888)
Just because a language has a GC, doesn't mean it doesn't have language features to have more fine grained control over how memory allocation takes place, or even when the GC has to run if at all.
Re:Rust in 2018: easier to use by littlestymaar on Sunday January 14, 2018 @07:31AM (#16143991)
In that case it's no different from Rust, Rust has a GC option (ref counting). It's limited and opt-in then you still carry the cognitive burden of memory management, you have to think when to use it. But if you need that level of control, you'll need to think about memory anyway.

And in my experience, it's way easier to reason about allocations in Rust that it is in Java (automatic type erasure if you want to use generic code) or Go (how will escape analysis behave in that case ?) for example. Rust traits are way better than C++ interfaces in that regard also.

Re:Rust in 2018: easier to use by pjmlp on Sunday January 14, 2018 @08:09AM (#16144108)
Java and Go are just two examples, and surely not those that I had in mind.

Rather languages in the Oberon and Modula family, D, Nim, Eiffel, C# as of 7.2, Common Lisp, and a few MLs.

If you do RC everywhere, using library types, it is slower than a tracing GC, and still not as productive.

Re:Rust in 2018: easier to use by seanmcdirmid on Sunday January 14, 2018 @09:40AM (#16144414)
UWP has ref counting, garbage collection (via C#), and stack allocation. It does native compilation to boot, unfortunately it isn’t quite universal.
Re:Rust in 2018: easier to use by pjmlp on Sunday January 14, 2018 @10:46AM (#16144696)
And is built on an improved COM, thus requiring first class support for it, by any language targeting UWP.
Re:Rust in 2018: easier to use by seanmcdirmid on Sunday January 14, 2018 @11:02AM (#16144778)
Ya, that’s right. But I think this is only C++ and C# at the moment.
Re:Rust in 2018: easier to use by pjmlp on Sunday January 14, 2018 @12:10PM (#16145057)
JavaScript on Chackra's engine, VB.NET, C# and C++. F# support is still to be done, due to how .NET Native handles MSIL.

Borland was in the process of doing it for Delphi and C++ Builder, but I don't know the current state. Originally they were only replicating the Metro UI, back on Windows 8.

Re:Rust in 2018: easier to use by trumpsamerica on Sunday January 14, 2018 @12:05PM (#16145020)
Isn't it universal windows? :)
Re:Rust in 2018: easier to use by Narishma on Monday January 15, 2018 @05:12AM (#16149656)
Yes, runs universally on all Windows 10 versions.
Re:Rust in 2018: easier to use by rapsey on Sunday January 14, 2018 @04:42AM (#16143512)
You're comparing a language to an OS and three GUI frameworks.
Re:Rust in 2018: easier to use by sho_hn on Sunday January 14, 2018 @04:50AM (#16143526)
I think there's some merit to the statement nonetheless - e.g. Qt is native to C++ and its API designed around C++ language features and semantics in many ways. There has been success in writing bindings for languages that can emulate those semantics without too much pain (e.g. PyQt), but Rust is not one of them.

Inside the Rust community, there's been a lot of debate about what an idiomatic Rust API for a GUI toolkit would look like, particularly because the traditional tree-of-widget-objects design of C++ GUI toolkits appears a bit inconvenient to realize within Rust's stricter semantics.

IOW, "are we gui yet?" might depend on some sort of new written-in-Rust GUI toolkit to appear. There's 20 years of work by many hundreds of people in Qt, many of whom rallied not just around Qt specifically, but around projects using it. Getting that many people moving isn't easy. Alternatively, major progress has to be made on bindings and bridging to the semantics of other languages in Rust.

That said - of course C++ was around quite a while before being adopted by Qt.

Re:Rust in 2018: easier to use by rapsey on Sunday January 14, 2018 @05:49AM (#16143702)
Servo guys have the potential to make something amazing (i.e. a sane electron type library). But I'm not sure how much they care about that. Other then that there is nothing serious going on.
Re:Rust in 2018: easier to use by sho_hn on Sunday January 14, 2018 @11:58AM (#16144993)
> a sane electron type library

There's no version of that concept that's sane at this time, though. Wrapping full-fidelity APIs the browser engine has access to in a lossy abstraction layer of shoddy web platform APIs isn't a practice Servo can improve upon. It takes improving those APIs.

Re:Rust in 2018: easier to use by IshKebab on Sunday January 14, 2018 @06:06AM (#16143748)
There's a project called Limn trying to do this. I doubt it has solved the ergonomics issue though.
Re:Rust in 2018: easier to use by rapsey on Sunday January 14, 2018 @06:20AM (#16143786)
Anyone pinning hope on limn should take a look at the activity on the project since start of December.
Re:Rust in 2018: easier to use by laumars on Sunday January 14, 2018 @07:35AM (#16144002)
You're talking about just over a month. I think it's a little unfair to expect people to maintain hobby projects every week of every year. Particularly over Christmas and the new year when our lives are often busier than usual.

To use a personal example, an open source project I actively maintain only yesterday saw it's first commits since the end of November. But I am still very much committed to that project.

Re:Rust in 2018: easier to use by littlestymaar on Sunday January 14, 2018 @07:22AM (#16143964)
I wouldn't be too pessimistic about a project just because the main author stopped pushing changes for one month in the holliday season. It also happened in August for the same project and work resumed later at a fast path.
Re:Rust in 2018: easier to use by coldtea on Sunday January 14, 2018 @09:35AM (#16144386)
If the project has only one main author, I would be. Even more so if they are on and off and not paid for it. Heck, TextMate and somewhat Sublime Text had such issues with 1 single dev, and those are projects that actually make them money...
Re:Rust in 2018: easier to use by laumars on Sunday January 14, 2018 @11:56AM (#16144984)
That's not a fair comparison as they weren't open source so it was impossible for the community to help contribute (and the community did want to contribute when it looked like development had stalled). Where as limn is open source so if it does prove worthwhile but development stalls it would be trivially easy for any number of other developers fork the git repo and carry on the work.
Re:Rust in 2018: easier to use by coldtea on Sunday January 14, 2018 @12:32PM (#16145176)
>That's not a fair comparison as they weren't open source so it was impossible for the community to help contribute

It is fair, as whether it's possible for the community to contribute is a moot point if the community wont contribute.

Heck, GTK+, which is used by millions, had just one person working on it full time a few years ago (not sure if changed since), and lamenting how there's no community help in the project's blog. And that's for a hugely used and know project. I doubt a Rust UI lib would get more than that.

Re:Rust in 2018: easier to use by laumars on Sunday January 14, 2018 @03:49PM (#16146329)
> It is fair, as whether it's possible for the community to contribute is a moot point if the community wont contribute.

Well as I had already said in my previous post, the community did want to contribute to Sublime Text but couldn't. Hence why I posted my rebuttal stating the original examples weren't really fair.

Your revised example is far more apt however in a roundabout way it just reinforces my original point. Since, by your own admission, any Rust UI lib is unlikely to see many dedicated contributors; it would be daft to criticize limn for a trait that you have just acknowledged would be typical for any Rust UI library.

To put things another way: if the project had stalled for months at a time then I could understand people's skepticism trusting the maintainer. However a brief period without commits during the holiday season seams more than reasonable for an active project. Particularly when you even comment afterwards that any similar project isn't likely to see more active development anyway. So why single this one out as being less trustworthy? It feels very much like your applying double standards here.

Re:Rust in 2018: easier to use by Conan_Kudo on Sunday January 14, 2018 @01:11PM (#16145392)
> Heck, GTK+, which is used by millions, had just one person working on it full time a few years ago (not sure if changed since), and lamenting how there's no community help in the project's blog. And that's for a hugely used and know project. I doubt a Rust UI lib would get more than that.

This is not true for GTK+ 3. GTK+ 2, however, has been in maintenance mode since the introduction of GTK+ 3 and has been in that state since.

Re:Rust in 2018: easier to use by rapsey on Sunday January 14, 2018 @12:25PM (#16145140)
> it would be trivially easy for any number of other developers fork the git repo and carry on the work.

Expecting that is wishful thinking. The fact of the matter is making something like that is an insane amount of tedious work and 99% of the time it is started up by people playing around with the concepts and abandoned once the initial fun problems are tackled. Something I am sure will happen with limn.

Re:Rust in 2018: easier to use by laumars on Sunday January 14, 2018 @04:03PM (#16146417)
I agree however that could equally happen with any similar Rust UI library that isn't backed by a corporate entity. And seeming as there isn't any corporate backed UI libraries for Rust (at least that I'm aware of), you're literally no worse off with limn than you are with anything else.
Re:Rust in 2018: easier to use by vvanders on Sunday January 14, 2018 @11:35AM (#16144901)
Qt uses way more than vanilla C++ though, it practically has its own dsl for a whole host of things.
Re:Rust in 2018: easier to use by sho_hn on Sunday January 14, 2018 @11:51AM (#16144970)
This often gets over-reported; old memes die hard.

There's a small number of macros that a custom preprocessor expands to (very pedestrian) generated code, but they are optional to use (though it's certainly uncommon not to use them) and these days there's template-based versions of some of them that are preferred and steadily finding adoption over the macro ones because they're superior. Beyond that there's a few more normal preprocessor-based macros that are entirely optional.

In that sense Qt also tracks vanilla C++ very closely and has adopted features from newer language versions at a fairly steady pace and swiftly for such a large production library set.

None of this matters much to my point though - that was about much more basic language semantics like classes-based OOP and the absence of ownership rules.

Re:Rust in 2018: easier to use by pjmlp on Sunday January 14, 2018 @06:48AM (#16143877)
No, I am comparing the selection of a specific programming language, given the existence of tooling for a specific purpose.

I need to fulfil task X, with tool Y, then I choose language Z among those supported by Y.

Not I chose language Z, then try to find some kind of Y, that helps me solve X somehow.

When C++ came into the picture we got Turbo Vision on MS-DOS bundled with Borland compilers, Apple adopted Metrowerks tools and used PowerPlant, OS/2 promoted CSet++, UNIX guys were into Motif.h++.

Then came Windows, Borland pushed forward with OWL followed by VCL. Microsoft created MFC, adopted by Symatec and Zortech compilers.

Apple eventually went Cocoa, and Microsoft UWP as of latest.

And then there is Qt, literally the only game in town for C++ GUIs not related to any OS vendor.

Followed by what in possible in Java and .NET eco-systems.

All with good visual tooling support, allowing for productive workflows between developers and designers.

I am not saying that Rust some day won't catch up, and offer something similar in terms of productivity.

I hope it does, but right now in 2018 it doesn't.

Re:Rust in 2018: easier to use by k__ on Sunday January 14, 2018 @07:20AM (#16143958)
Isn't Rust perfect for severless?

Since cloud providers do all the plumbing, Rust would only have to deliver a tiny Linux binary for the function.

Re:Rust in 2018: easier to use by AzzieElbab on Sunday January 14, 2018 @07:27AM (#16143980)
I do not think it will be tiny after including all the required and atm non existent SDKs