News for hackers. Stuff that matters.
Re:The rise of wgpu by asddgsgsaxg on Thursday March 07, 2019 @11:26AM (#19329324)
> seeing "WGPUSwapChainId" tells me exactly what sort of object is returned (a reference to some object held elsewhere)

Check out RLS (the rust language server) to get intellisense like this working in your favorite editor.

Re:The rise of wgpu by jonathanyc on Thursday March 07, 2019 @11:55AM (#19329632)
I think that in reviewing code this is definitely something where languages with type inference lose clarity; Rust is even worse because of the Deref/Into idioms.

I think the solution is for diff viewers incl. those on the web to support something like intellisense, but obviously we are a very long way away from that.

Re:The rise of wgpu by devit on Thursday March 07, 2019 @12:05PM (#19329733)
You could have the compiler produce a fully explicit version (I'm not sure if Rust can do that out of the box at the moment)
Re:The rise of wgpu by steveklabnik on Thursday March 07, 2019 @12:08PM (#19329761)
~~It can't.~~ See below, it can!

I tend to find, personally, that this kind of thing doesn't interfere strongly with reviewing. I think this is because I have an extensive background in dynamically typed languages and ones with strong inference like Rust, so I'm more used to it, whereas people who don't come from said backgrounds prefer more explicitness. YMMV of course!

Re:The rise of wgpu by Tohquai7 on Thursday March 07, 2019 @01:05PM (#19330397)
It can.

-Z unstable-options -Zunpretty=hir,typed

    // source
    pub fn square(num: i32) -> i32 {
        num * num
    }

    // expanded
    use ::std::prelude::v1::*;
    extern crate std;
    pub fn square(num: i32)
     -> i32 ({ ((num as i32) * (num as i32) as i32) } as i32)

You can try on https://rust.godbolt.org/
Re:The rise of wgpu by steveklabnik on Thursday March 07, 2019 @01:07PM (#19330420)
Oh dang! That's very cool, thank you!
Re:The rise of wgpu by jonathanyc on Thursday March 07, 2019 @01:05PM (#19330396)
I don’t think it’s just “strong” inference that’s the problem; I find I have an easier time reading ML because the inference somehow feels more obvious. After thinking about it some more, I think it really is deref coercion that is the gotcha, especially with function chaining.
Re:The rise of wgpu by steveklabnik on Thursday March 07, 2019 @01:08PM (#19330429)
By "strong" I really mean "type inference" over "type deduction", to be clear. But yeah, I could see that.