Live data from Hacker News

Rust's language ergonomics initiative

blog.rust-lang.org

181–190 of 295 posts

Re: Rust's language ergonomics initiative

#181

I hope the ergonomics initiative takes it towards Java rather than Python. For all the hate it gets, Java's explicitness is a boon when maintaining large scale systems and preventing bugs.

What parts of Java are you thinking of? When I think of explicitness Java has but Python doesn't, types mostly come to mind, but Rust is already statically typed, so that can't be what you mean.

Re: Rust's language ergonomics initiative

#182
post #166
post #126

> Right now, such a signature would be accepted, but if you tried to use any of map’s methods, you’d get an error that K needs to be Hash and Eq, and have to go back and add those bounds. That’s an example of the compiler being pedantic in a way that can interrupt your flow, and doesn’t really add anything; the fact that we’re using K as a hashmap key essentially forces some additional assumptions about the type. But…

Type inference should solve that if Go ever gets that.

This has already been requested quite often, the Go team refused pretending it wasn't "readable". "readability" is their number one excuse to get away with not discussing a feature at first place.

Re: Rust's language ergonomics initiative

#183
post #85
post #41

Earlier quoted context omitted.

"If you're developing software for unsophisticated users it's obvious that you should be doing user testing" Compilers actually have a unique opportunity to introduce some form of opt-out tracking of all of the compilation errors with sources, etc. This could really help to understand the users.

No, that's not how it's done. Proper testing for computer usability involves video of the user and the screen. The important things to note are when the user stops, gets stuck, has to consult external references, asks for help, or gets upset. It's far too intrusive to impose on anyone not explicitly volunteering to do it.

Unfortunately I have but only one upvote to give. This is very important if you're performing a usability / ergonomics study. Context matters a great deal. The parent poster is also quite correct about it being invasive: although not absolutely necessary, ideally you'd observe the user in whatever context they happen to use Rust (e.g. at their workplace or in their home). Lab studies are still valuable too, but you might miss some context due to the artificial setting.

Re: Rust's language ergonomics initiative

#184

My biggest and probably only real frustrating with Rust is that modules and crates live in the same namespace. That makes stuff incredibly confusing to teach and read. I can otherwise live with the explicit extern/mod if needed.

They need to live in the same namespace, otherwise you'd practically need different syntax for importing something from a crate, or a module. You can use `extern crate foo as bar`, if you are having namespace issues.

Re: Rust's language ergonomics initiative

#185

From moving from Perl to Rust, the only thing that I miss is the postfix "if": return true if number > 2; VS: if number > 2 { return true } I find that one-liners like these are really ergonomic.

ProTip: In both languages you can do the following: return number > 2;

Not really the same thing. The Perl version is generally used as an early abort either from a subroutine or a loop.

    return if($number > 2);
Is equivalent to:

    if($number > 2){
        return;
    }

Re: Rust's language ergonomics initiative

#186

Great initiative By its very nature, Rust is harder (than let's say Python or JS). It is compiled, there's not much runtime magic to rely on and low level is hard. But thinking about this and trying to make it easier is important

What does hard have to do with compiled or not? Visual Basic was actually compiled and it was and still one of the easiest languages to learn ever.

Re: Rust's language ergonomics initiative

#187

I still can't get my head around rust. While all those features definitely make sense, I find it very confusing sometimes. Is there something like rust for c++ programmers?

Curious, is it harder for c++ programmers to learn Rust than dev from higher level devs? Because ive seen Rust has a lot more success recruiting devs from python, js, even php.

Re: Rust's language ergonomics initiative

#188

Earlier quoted context omitted.

Note that this is different from what's being asked, what's being asked is why they can't have fields like abstract classes that get appended to the original struct. That would make traits more like mixins. That RFC lets you declare fields that the trait implementor is supposed to provide; implementing a trait will not automatically add a field, instead, you will be forced to add such a field yourself (unless one alr…

While it's not what I asked, I actually like the answer as long as I can provide overrideable default methods in the that use the lvalues. I can't think of any of my own use cases that couldn't adequately be covered by it.

Oh, yeah, like I said it solves many of the same use cases, it's just not the same thing :)

Re: Rust's language ergonomics initiative

#189
post #125

After writing Rust in production for a while, the biggest bugbear I have is the naming/file structure. I end up a lot with this; src/main.rs src/combobulator/mod.rs src/combobulator/tests.rs src/tests.rs src/somethingelse/tests.rs src/somethingelse/mod.rs Because I find tests in the same file a bit confusing. It's really easy with maven-style layouts to know that "only things in main/java or main/scala get compiled a…

I prefer to keep tests in a `mod tests { ... }` block at the end of the source file, which provides comparable benefits and separation. I also prefer to use `combobulator.rs` rather than `combobulator/mod.rs`, for multiple reasons including filename ambiguity. In this case, you'd have: src/main.rs src/combobulator.rs src/somethingelse.rs

I think this is a very common standard. At least, its what I have seen most often.

Re: Rust's language ergonomics initiative

#190
post #66

Earlier quoted context omitted.

I suppose the question then is, did writing Unix make C ergonomic? :)

Good question :) I think it did, though I'd be interested to hear an informed opinion.

I, for one, see C as both unsafe and unergonomic. The many features of C++ can be seen as various attempts to make some or another thing expressible in C -- parameterized datatypes, namespacing, encapsulated resource management -- that wasn't before.
Post reply on HN