News for hackers. Stuff that matters.
Re:Rust's 2017 Roadmap by DeepYogurt on Monday February 06, 2017 @03:37PM (#13583623)
Don't change the language to make it easier (unless that can be a free lunch), but get someone doing a "Today in rust" or "Doing X in rust" blog/vlog. Also please get some sort of RNG into the main language (not as a crate).
Re:Rust's 2017 Roadmap by GolDDranks on Monday February 06, 2017 @03:45PM (#13583695)
The Rust's goals of high performance, safety and pay-what-your-use and you-couldn't-hand-code-better won't be sacrificed for sure. The point in ergonomics improvements is to identify "free lunches" that aren't yet taken advantage of.

That being said, lifetimes and traits being both complex and unfamiliar features, there's always going to be quite of a learning curve. But one can always reduce the amount of papercuts. If nothing else, one can at least make the documentation better, the ecosystem libraries better and error messages even smarter.

Re:Rust's 2017 Roadmap by junk_disposal on Monday February 06, 2017 @04:31PM (#13584272)
Can you say that traits are like Go interfaces?
Re:Rust's 2017 Roadmap by steveklabnik on Monday February 06, 2017 @04:37PM (#13584347)
Yes and no; I've always really enjoyed http://softwareengineering.stackexchange.com/questions/24729... as a comparison between the two.

It's old enough that it's before Rust 1.0, so some of the syntax is a _teeny_ bit wrong (int isn't a type any more, you'd use isize) but the macro picture is the same.

Re:Rust's 2017 Roadmap by bryanlarsen on Monday February 06, 2017 @03:39PM (#13583639)
Re:Rust's 2017 Roadmap by Manishearth on Monday February 06, 2017 @03:40PM (#13583651)
Any particular reason rng must be in the stdlib? It's an "official" crate, maintained by the Rust developers. In general Rust tries to keep things out of its stdlib instead opting for crates. It lets these evolve independently of the stdlib (not tied to rustc releases), and also lets them have their own versioning (none of that urllib2 urllib3 nonsense)
Re:Rust's 2017 Roadmap by sevensor on Monday February 06, 2017 @04:05PM (#13583923)
It's a battery people are pretty well used to seeing included in a language. POSIX even mandates one for C. For repeatable simulation work you might want something more robust, and hopefully everybody knows it's no use for crypto, but it's a handy thing to have around if you need to flip a digital coin.
Re:Rust's 2017 Roadmap by Manishearth on Monday February 06, 2017 @04:14PM (#13584047)
It's not harder to use in Rust than it is to pull in a C header file, though.
Re:Rust's 2017 Roadmap by XorNot on Monday February 06, 2017 @04:01PM (#13583876)
I would say random numbers are a fairly core programming construct for a standard library. They're important, difficult to get right, and have huge implications if you get them wrong.
Re:Rust's 2017 Roadmap by wyldfire on Monday February 06, 2017 @04:05PM (#13583936)
But given how easy/simple/common it is to depend on a crate, what practical problem would it solve for it to be in libstd? Maybe it's difficult for the community to identify the anointed RNG?
Re:Rust's 2017 Roadmap by vertex-four on Monday February 06, 2017 @05:25PM (#13584855)
So's encryption, possibly moreso, and yet that probably shouldn't be in the standard library.
Re:Rust's 2017 Roadmap by Manishearth on Monday February 06, 2017 @04:13PM (#13584031)
This doesn't answer my question, though. Most of the "fairly core programming constructs" are not in the stdlib for Rust (like regexes)

The Rust stdlib is mostly core abstractions and platform-dependent stuff.

Given that, why should they be in the stdlib? The rand crate is officially blessed and the one everyone uses.

Re:Rust's 2017 Roadmap by iopq on Tuesday February 07, 2017 @03:34AM (#13587999)
You can't use rand in play.rust-lang.org so it's hard to get help from IRC since they can't get your error messages easily and fix them.
Re:Rust's 2017 Roadmap by sevensor on Monday February 06, 2017 @04:47PM (#13584465)
In that case, it sounds like "officially blessed crates" are a second-level stdlib with weaker guarantees about availability across time and across platforms. I'm fine with that idea, but from my outside perspective this is a confused message. Better to call the blessed crates "stdlib extensions" or something like that.
Re:Rust's 2017 Roadmap by Manishearth on Monday February 06, 2017 @05:02PM (#13584646)
Why "weaker guarantees across platforms"? These crates have the same guarantees about platform support. Availability across time is also similar, really.
Re:Rust's 2017 Roadmap by 1wd on Monday February 06, 2017 @06:02PM (#13585158)
In most other programming languages functions in the standard library:

* Are guaranteed to work correctly on all platforms where the language works.

* Will always work with the latest stable release of the language.

* Will be available under one single permissive license (with a single copyright holder (body) for any purposes of required notices etc.)

* Will be supported (security patches, bug fixes, etc.) with backward compatibility, more or less indefinitely (with reasonable long time frames for deprecation windows and recommended transition plans etc.)

* Are under no danger of being abandoned simply due to lost interest of the author.

* Crucial: Will only depend on other code in the standard library. (So all these guarantees are transitive!)

And anything that's not in the standard library usually implies there are no such guarantees. This is immensely more helpful and important than the comparatively trivial ease-of-installation.

If the Rust team really does explicitly extend such guarantees to non-standard library crates, that should be clearly and widely communicated. So far the focus seems more on how small the standard library is. What's the advantage for the language user? I see advantages for the Rust team, and mainly I see disadvantages for the (professional) language user. Easy-to-use cargo is nice (especially for casual language users) but is nowhere close to really making up for that.

Re:Rust's 2017 Roadmap by Manishearth on Monday February 06, 2017 @06:18PM (#13585274)
Most of these are true for rand. It's in the nursery so it might (probably not though) be deprecated in favor of a different library, but it would continue to work because Rust is backwards compatible.

https://github.com/rust-lang/rfcs/blob/master/text/1242-rust... has some of the motivation behind this.

Re:Rust's 2017 Roadmap by sevensor on Monday February 06, 2017 @09:03PM (#13586317)
Thank you for the link, that clarifies the Rust team's thinking! As an outsider considering Rust for a project at work, I'd recommend you put that somewhere front and center -- it's one of the more confusing things about the Rust world.
Re:Rust's 2017 Roadmap by 1wd on Monday February 06, 2017 @06:37PM (#13585430)
Thanks, but I still don't see where such guarantees are advertised. Also it's not really clear what "the nursery" is exactly. Where is it? Why is it called that? It sounds more like "not mature = ready for prime time = don't use this".

According to that link, regex is also in the nursery. According to crates.io, regex depends on other crates maintained elsewhere, by a "random" single developer, under a different licenses, with zero obvious guarantees.

Re:Rust's 2017 Roadmap by Manishearth on Monday February 06, 2017 @08:12PM (#13586051)
Crates.io lists the authors as "The Rust Project Developers", and has the Rust libs team as an owner. The dependencies are almost all maintained by Rust libs team members or are otherwise trusted crates.

https://crates.io/crates/regex

(Regex moved out of the nursery a while back)

The nursery is more of a "These crates are officially blessed and we wish to make them part of rust-lang, unless the community comes up with something better".

The guarantees aren't advertised, they're known. We can do a better job of advertising this, some of the work this year is related to that.

Re:Rust's 2017 Roadmap by 1wd on Tuesday February 07, 2017 @06:49AM (#13588758)
Sorry, I meant the author and license of e.g. this dependency of regex: https://crates.io/crates/aho-corasick

I'm sure the Rust team knows and trusts these (or they even are Rust team members), but how should outsiders know this?

Researching trustworthiness of individual authors, getting approval for different licenses, tracking and updating required notices in documentation etc. for every single dependency transitively(!) seriously takes a lot of effort. Updating dependencies that switch sub-(sub-...)-dependencies freely can turn from a simple cargo command into a month of work. A big standard library (or an equivalent construct) can really save the day there.

> The guarantees aren't advertised, they're known.

It is known. -- Jhiqui

Glad to hear improving this is in the works anyway.

Re:Rust's 2017 Roadmap by steveklabnik on Monday February 06, 2017 @06:49PM (#13585530)
RFCs are frozen in time; regex has since moved under rust-lang, and has a pre-release for a 1.0.

That person isn't random; they're on the libs team and the primary author of regex. (there are a few crates by other people as well, but most of those crates were extracted from regex as they can be useful on their own.)

Re:Rust's 2017 Roadmap by 1wd on Tuesday February 07, 2017 @07:05AM (#13588800)
My point is researching all this puts a huge burden on (serious) users that would not be there for a big standard library. Currently the Rust approach seems quite problematic, but I think this can be solved. For example by an explicit guarantee pledged by the Rust team (or a related umbrella / organization / consortium / ...) for a certain set of libraries (platform / ecosystem / 2nd tier standard library extension / stdx / nursery / ...).

I think it would be important to include in this pledge:

* Transitive closure rule. (No external dependencies not covered by the pledge. Possibly with certain exceptions e.g. for bindings to big known obvious third party dependencies like SQL databases or Operating Systems.)

* Uniform licensing rule. (Everything must use the exact same license, with a single group name as copyright holders and for any purposes of required notices etc.)

* Maintenance, backward compatibility and platform compatibility rule. (100% compatibility forever everywhere is not even necessary, but an _explicit_ rule of thumb of what reasonable time frames for deprecation windows and recommended transition plans can be expected would be nice.)

Or maybe this already exists and I'm just uninformed?

Re:Rust's 2017 Roadmap by steveklabnik on Tuesday February 07, 2017 @12:00PM (#13590703)
It all exists, it's just not as advertised as it should be.
Re:Rust's 2017 Roadmap by sevensor on Monday February 06, 2017 @08:52PM (#13586267)
It speaks to my confusion about the role of these "blessed" crates that I assumed the reason for not including them in the standard library was that they were not supported on all platforms, or that you didn't want to commit to having them in stdlib forever. If neither of these is the reason, and you intend for these crates to persist indefinitely and be available on all supported platforms, surely they belong in the standard library?

For context, I'm a Python programmer by day and well used to the comforts of its expansive standard library. From that perspective, splitting your stdlib into a first-class and a second-class stdlib seems weird, and I'm trying to make sense of it.

Re:Rust's 2017 Roadmap by Manishearth on Tuesday February 07, 2017 @01:34AM (#13587553)
The idea is that these can evolve separately from the language; they are not tied to language versions. Contrast that with Python where you have the urllib urllib2 urllib3 issue; with people going and using requests anyway.

There's no inherent reason to put them in the stdlib aside from "other languages do it".

And yeah, folks don't want to commit to sticking them in the stdlib forever. If a better library turns up people can switch to that; without being tied to the language version. These libraries will still be maintained, but may no longer be the recommended way to do things. Being outside the stdlib gives some liquidity to the crate.

Re:Rust's 2017 Roadmap by mook on Tuesday February 07, 2017 @03:38AM (#13588017)
The Python urllib/urllib2 issue is a feature. It means any code that uses the old (inferior) urllib continues to work, without having to update it as urllib2 starts being used within the same function so that it can be migrated. That's what promising stability means.

This applies to your last paragraph as well -- I do want to be using code that folks are trusting to be the way to do things forever (well, at least for a few years). I'm not trying to learn yet another CADT language / ecosystem.

Also note that both crates mentioned in this subthread (regex and rand) are at version 0.x; to a not-really-a-rust-person like me, it signals "experimental API, avoid avoid avoid". I assume that is the reason to start a concerted effort to get everything to 1.0 levels.

(I'm mostly commenting because the roadmap under discussion seems to be heading towards the sort of promised stability that I want to see; so having somebody known to be rather close to rust development saying the exact opposite rather unsettles me. Sorry.)

Re:Rust's 2017 Roadmap by steveklabnik on Tuesday February 07, 2017 @12:02PM (#13590717)
(regex is only pre 1.0 because its release candidate is in testing, it looks like 0.2 is gonna become 1.0 with no changes)

> It means any code that uses the old (inferior) urllib continues to work,

Rust lets you have multiple versions of a transitive dependency in your project, so they would continue to work.

Re:Rust's 2017 Roadmap by steveklabnik on Monday February 06, 2017 @03:39PM (#13583645)
What advantage would putting an RNG into the language do? Are there any languages where an RNG is a language construct?
Re:Rust's 2017 Roadmap by kzrdude on Monday February 06, 2017 @04:11PM (#13584005)
Relieve crates of version coupling stress. I effectively can't release an 1.0 crate if I have rand as a public dependency; if it has a new major version, I need to have that too to keep in sync and do versioning right.

Rand is a vocabulary crate (traits Rng and Rand are used for inter-crate exchange), so it's very sensitive to version coupling.

Re:Rust's 2017 Roadmap by steveklabnik on Monday February 06, 2017 @04:22PM (#13584153)
Interesting, thanks. That does seem valuable; I'm not sure that rand is gonna shoot for a 2.0 any time soon after its 1.0, but that is something being in-tree would prevent.

"vocabulary traits" like this are a good candidate for the stdlib for exactly this reason, maybe a good compromise would be putting _those_ in the stdlib, but leaving the implementation outside.

Re:Rust's 2017 Roadmap by akiselev on Monday February 06, 2017 @05:47PM (#13585051)
> "vocabulary traits" like this are a good candidate for the stdlib for exactly this reason, maybe a good compromise would be putting _those_ in the stdlib, but leaving the implementation outside.

How would this interact with the orphan rule? Wouldnt this mean the vocabulary traits would not have default or std library type implementations and would have to be wrapped in newtypes, defeating the purpose of having them for inter-crate exchange? I guess you could wire types explicitly with Into/From in user code. Are there any traits unimplemented in std now that these vocab traits would look like?

Re:Rust's 2017 Roadmap by steveklabnik on Monday February 06, 2017 @06:33PM (#13585388)
It helps with the orphan rule, as everyone would be importing the trait from std. From/Into are the same kind of traits. That is, the idea is that the rand crate would implement std::rand::Random, and so would some rand2 crate, and then I could write my own crate saying

    fn random<R: std::rand::Random>(r: R)
and it would work with either one. No need for newtypes.

I also might be missing something.

Re:Rust's 2017 Roadmap by epage on Monday February 06, 2017 @06:12PM (#13585233)
stdlib or in a crate for just the trait similar to log?
Re:Rust's 2017 Roadmap by steveklabnik on Monday February 06, 2017 @06:28PM (#13585353)
The parent is worried about 2.0, so that would imply in stdlib. No reason it couldn't be done as a crate just for the trait as well, but that at least leaves the possibility of a 2.0 open.
Re:Rust's 2017 Roadmap by kzrdude on Monday February 06, 2017 @09:04PM (#13586326)
Not worried about 2.0.

Rand is at version 0.3 and stagnating. I'm worried about 0.3, 0.4, 0.5. Those that have rand as a public dependency cannot release 1.0 now, if they do, they need to release 2.0 when rand goes to 0.4 and so on.

Re:Rust's 2017 Roadmap by Manishearth on Monday February 06, 2017 @03:43PM (#13583678)
I think they mean stdlib. RNG is not in the language for any language I can think of.
Re:Rust's 2017 Roadmap by Animats on Monday February 06, 2017 @04:05PM (#13583932)
It's in BASIC, as RND(). The usual Basic RNG is good enough for games, but not good enough for crypto.
Re:Rust's 2017 Roadmap by davidtgoldblatt on Monday February 06, 2017 @04:12PM (#13584016)
It's part of the core language semantics (arguably the core language semantics) for Java2K (http://p-nand-q.com/programming/languages/java2k/).