
Rust's 2017 roadmap, six months in - darwhy
http://blog.rust-lang.org/2017/07/05/Rust-Roadmap-Update.html
======
Lerc
One of the things that I'd like to see for the Rust Book is some form of
"Here's how to use it in a function".

For example, Taking a random piece of code from the Rust Book

    
    
        let buffer: &mut [i32];
        let coefficients: [i64; 12];
        let qlp_shift: i16;
    
        for i in 12..buffer.len() {
            let prediction = coefficients.iter()
                                         .zip(&buffer[i - 12..i])
                                         .map(|(&c, &s)| c * s as i64)
                                         .sum::<i64>() >> qlp_shift;
            let delta = buffer[i];
            buffer[i] = prediction as i32 + delta;
        }
    
    

How would one break part of this into a function

    
    
        fn get_part ??? What might go here ???  
    
        let buffer: &mut [i32];
        let coefficients: [i64; 12];
        let qlp_shift: i16;
    
        for i in 12..buffer.len() {
            let prediction = get_part(&coefficients,&buffer,i)
                                         .map(|(&c, &s)| c * s as i64)
                                         .sum::<i64>() >> qlp_shift;
            let delta = buffer[i];
            buffer[i] = prediction as i32 + delta;
        }
    
    

[Exercise for the reader] I'm not sure If I could write the code to do this
without taking a few wrong turns.

~~~
steveklabnik
Well, this code in particular is presented as "hey there's no context." If I
were to try to extract this, I would take each of those lets and make them an
argument, then see what the compiler says for the return type, done.

~~~
pjmlp
This is one example where having a REPL would help a lot.

That is how I check such types outside IDEs in other ML derived languages.

~~~
roblabla
TBF, you can just do

    
    
        let _ : () = /* some expr whose type you don't know */
    

And compile it. It will quickly fail with a type error, giving you the full
type of the expression.

~~~
pjmlp
Yeah, but it feels like a kluge, specially when used to F# on Visual Studio.

------
MichaelGG
Is seems that Racer is still missing support for auto-complete on basic code
snippets:

    
    
      let x = vec![1]
      x.<no completion>
    

Even if they special cased vec! or all the std macros, it'd be a good on-ramp
improvement. But I thought RLS was supposed to step in where Racer can't
handle things - is that not the case for macro support?

~~~
saghm
> Is seems that Racer is still missing support for auto-complete on basic code
> snippets

Interesting; I view that as a bit more than a "basic" snippet for
autocompletion to handle, although that's mostly a few facto interpretation
because it's one of the few things that no Rust autocompletion engine I've
tried (racer, RLS, or Intellij's plugin) has been able to handle. For pretty
much everything else I've tried, at least one of them has been able it.

~~~
MichaelGG
Well I mean it's basic in the sense of it's a common piece of code a beginning
might write in the first few minutes with Rust.

~~~
saghm
Fair enough! I definitely agree with you there

------
shock
I was really hoping we'd have bindings to Qt by now, but looking at the GUI
category on crates.io I didn't find any. What do people use to make cross
platform GUIs in Rust?

~~~
nicoburns
GTK is the best option at the moment. Apparently QT is difficult due to it
being heavily based in C++'s view of the world, which doesn't translate
particularly well to Rust (notably Rust not supporting OOP in the same way).
There is hope of a new rust-native GUI library (possibly in the vain of
Flutter[1]) based on the work done for Servo[2], but that looks to be a way
off.

[0]
[https://www.reddit.com/r/rust/comments/6l5c94/can_we_crowdfu...](https://www.reddit.com/r/rust/comments/6l5c94/can_we_crowdfund_a_crossplatform_gui_lib_for_rust/)
[1] [https://flutter.io/](https://flutter.io/) [2]
[https://github.com/servo/webrender](https://github.com/servo/webrender)

~~~
shmerl
I think translation problems aren't caused by OOP itself, but by messed up
name mangling, and total lack of any sane standard for it in C++.

~~~
pcwalton
Name mangling is almost completely a non-issue. We solved it years ago for the
Servo SpiderMonkey bindings, to name one instance.

~~~
shmerl
What is the most difficult part for Qt then? Translating some of its concepts
in Rust?

~~~
civilitty
AFAICT, QT has its own implementation of signals and slots (events and event
handlers essentially) which is a pain for Rust's ownership model and it also
has a code generator that deals with some of C++'s limitations, making it
harder to generate usable bindings. If that weren't enough, there is no native
(clean) Rust way to do C++ inheritance which is another big pain.

------
clumsysmurf
"Even better, you can pre-order a printed version through No Starch Press."

Thanks for choosing a publisher that supplies DRM-free eBooks ;)

~~~
quodlibetor
It's available online: [https://doc.rust-lang.org/book/second-
edition/](https://doc.rust-lang.org/book/second-edition/) , a publisher that
didn't believe in digital sharing that also agreed to publish it would be a
little... surprising.

~~~
clumsysmurf
That would be MIT press (sometimes). For example
[https://mitpress.mit.edu/books/deep-
learning](https://mitpress.mit.edu/books/deep-learning) is available at
[http://www.deeplearningbook.org/](http://www.deeplearningbook.org/) , but you
can't get DRM-free ePubs or PDFs.

------
ofek
Those integrations with other languages look awesome! I just wish there was a
good one for Python.

~~~
Dowwie
@mitsuhiko has been working on one:
[https://github.com/mitsuhiko/snaek](https://github.com/mitsuhiko/snaek)

and there's "pythonium trioxide", but I've gotten the impression that its more
of an exploratory project:
[https://github.com/PyO3/PyO3](https://github.com/PyO3/PyO3)

~~~
fafhrd91
PyO3 is close to first release.

~~~
Dowwie
I'm looking forward to it!

------
abiox
still hoping that someday we'll see namespacing in crates/cargo.

~~~
raphlinus
This has been discussed quite a bit, and there are very good reasons why
not[0]. But I suppose things can always change.

[0]: [https://internals.rust-lang.org/t/crates-io-package-
policies...](https://internals.rust-lang.org/t/crates-io-package-
policies/1041)

~~~
Perceptes
And as a result we have to deal with dumb shit like this:

[https://twitter.com/jdalton/status/869964222716821504](https://twitter.com/jdalton/status/869964222716821504)

(continued)
[https://twitter.com/littlecalculist/status/87035656004781670...](https://twitter.com/littlecalculist/status/870356560047816704)

------
kevinSuttle
> We’ve also been working on a number of language changes aimed at improving
> language ergonomics.

[http://bukk.it/clap.gif](http://bukk.it/clap.gif)

