Uh oh!
There was an error while loading. Please reload this page.
RFC: Stabilize std::prelude - #503
Conversation
Stabilize the `std::prelude` module by removing some of the less commonly used functionality of it.
alexcrichton
commented
Dec 8, 2014
cc #497, an RFC specifically about |
SimonSapin
commented
Dec 8, 2014
Assuming that user-defined preludes need to be opted into, the syntax for that could be |
aturon
commented
Dec 8, 2014
That doesn't quite give you the effect of the prelude, because it applies only to the current scope. There are some proposals in the works for allowing you to specify a custom prelude in your crate root that will be wholly imported into all scopes within the crate. A feature like this would make it relatively easy to make "changes" to the |
steveklabnik
commented
Dec 8, 2014
I am 👍 for this. |
There was a problem hiding this comment.
Nope, it imports the Ordering enum, like cmp::{mod, Ordering} would import cmp and cmp::Ordering.
kmcallister
commented
Dec 9, 2014
// The prelude will be responsible for providing unicode-respecting methods on// primitives while requiring that ascii-specific manipulation is imported// manually.I'm skeptical of providing Unicode-respecting methods in the prelude, because the operations are so complicated, with locale-dependence and many choices to make. It might be better to require the user to specify, via imports, which flavor of operations they're using. There are a lot of formats (like HTTP and HTML) that use machine-interpreted text with ASCII-case-insensitive matching. This is a subtly different data type from "text written by humans for human consumption", but it's not worth forking |
kmcallister
commented
Dec 10, 2014
// While currently present in the prelude, these traits do not need to be in// scope to use the language syntax associated with each trait. These traits are// also only rarely used in bounds on generics and are consequently// predominately used for `impl` blocks. Due to this lack of need to be included// into all modules in Rust, these traits are all removed from the prelude.
...pubuse ops::{Deref,DerefMut};Because of rust-lang/rust#15609, it is sometimes necessary to introduce an explicit |
SimonSapin
commented
Dec 10, 2014
I disagree with "just as likely". You and I use ASCII-only case-insensitive matching routinely, but it’s fairly domain-specific: it only makes senses in a namespace like HTML element names where every "valid" name is ASCII, it’s just wrong on full Unicode text. It definitely should not be in the prelude. As to Unicode case folding, some variations of it are locale-independent. Sure, they’re also wrong for the a few cases like the dotted/dotless iİıI in Turkish, but they’re much less wrong than ASCII-only. ( I think that some people will want to "just do XYZ" and not care about Unicode subtleties, much less being forced to specify a content language (which might just end up hard-coded to |
alexcrichton
commented
Dec 10, 2014
@kmcallister right now we are quite strict about I expect we will very clearly document precisely what |
alexcrichton
commented
Dec 14, 2014
The discussion here seems to be slowing down, so I may try to look to merge this soon. ping @kmcallisterabout unicode in the prelude |
aturon
commented
Dec 14, 2014
I think we should do it, yes (probably Broader context for others reading: we hope to eventually allow you to specify a custom prelude at the top of your crate (which would be glob imported everywhere, just as If we don't introduce internal namespacing like this, there would not be a clear place for new prelude versions to go. On the other hand, if we never end up evolving the prelude in this way, having |
sfackler
commented
Dec 14, 2014
I'm sitting on a proposal that should hopefully eliminate much of the need for third party preludes and the addition of anything to the libstd prelude, but sticking the current prelude in a |
aturon
commented
Dec 14, 2014
@sfackler Interesting! FWIW, the plan I had in mind was roughly to add a Curious to hear what you have in mind! |
sfackler
commented
Dec 14, 2014
The tl;dr is to provide a way of marking a trait impl as always being in scope (e.g. In any case, it's a pretty clear post-1.0 improvement, so I'm not planning on writing it up formally until after the initial release. |
aturon
commented
Dec 14, 2014
@sfackler Ah ok, we've discussed that in the past. I don't think that completely covers what preludes offer, but it would certainly help! |
alexcrichton
commented
Dec 16, 2014
I've pushed an update which recommends |
Gankra
commented
Dec 19, 2014
Collections Reform v1 adds |
aturon
commented
Dec 20, 2014
@gankro I think for the alpha, we're going to leave |
aturon
commented
Dec 20, 2014
While there has been surprisingly little discussion on this RFC thread, it's been brought up in the meeting and seen fairly widely in the community, and we need to move forward before the alpha. The core team has reviewed the RFC and is happy with the direction it's taking. We will also have an opportunity to tweak the exact contents before beta/1.0. |
Stabilize the
std::preludemodule by removing some of the less commonly usedfunctionality of it.
Rendered