Uh oh!
There was an error while loading. Please reload this page.
std: Remove index notation on slice iterators - #25006
Conversation
rust-highfive
commented
Apr 30, 2015
r? @gankro (rust_highfive has picked a reviewer for you, use r? to override) |
alexcrichton
commented
Apr 30, 2015
r? @aturon |
alexcrichton
commented
Apr 30, 2015
Note that I figured that the |
aturon
commented
May 1, 2015
@alexcrichton But the main holdup with that RFC remains the I think there are also some other concerns about this |
There was a problem hiding this comment.
re: the unstable comment -- should we consider future-proofing this by returning a newtype around unit?
There was a problem hiding this comment.
Oh wow I totally missed that! I think that it may actually be appropriate in this case as String::from_str can never fail. It would in theory be more appropriately represented as Result<String, Void>, but adding Void probably isn't super well motivated by this use case.
There was a problem hiding this comment.
Right, but this might be one reason to leave it opaque for the time being -- so that if we get Void (which has come up from time to time, and is a tiny API) we could switch over to it.
There was a problem hiding this comment.
Hm ok, I've switched it over to an #[unstable]ParseError newtype in the module.
aturon
commented
May 1, 2015
I don't recall where the |
alexcrichton
commented
May 1, 2015
@aturon hm yes those are good points, I would also be fine removing the |
5bdc2ab to
c41497fComparealexcrichton
commented
May 1, 2015
I've pushed a new commit which removes the |
2f3ea53 to
776b4d0CompareThese implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closesrust-lang#24791
776b4d0 to
b1976f1Comparealexcrichton
commented
May 1, 2015
aturon
commented
May 1, 2015
Note: @alexcrichton and I discussed this further, and determined that the |
bors
commented
May 1, 2015
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes#24791 [breaking-change]
bluss
commented
May 1, 2015
@aturon thanks for the info. Shouldn't we have an RFC-style discussion about it? |
bors
commented
May 2, 2015
aturon
commented
May 4, 2015
@bluss The sense was that these operators are widely used enough and match the collections reform reasonably enough to be stabilized as-is. (The complaints I've heard about them -- operator "abuse" -- apply equally to the set operations which were approved in the earlier RFC.) We're still working out exactly what requires an RFC, but this simple ungating didn't seem to warrant it. That all said, if you have objections I would love to hear about your concerns, and we could certainly consider removing the implementations for now (though that would likely break code). |
bluss
commented
May 4, 2015
I've had these objections for a long time, and I'm sure I've explained before.
|
bluss
commented
May 4, 2015
cc @bstrie I think you wanted to know about Add for Vec. |
aturon
commented
May 4, 2015
@bluss Sorry to make you repeat yourself! I think I must have missed the previous discussion on this topic. @alexcrichton Perhaps we should consider removing the impls for now, after all, and have them go through an explicit RFC process as @bluss is requesting? I feel like it's a borderline case (came in without an RFC), but it's certainly an optional enough feature that removing it shouldn't cause much pain. @gankro I'd also appreciate your thoughts here. |
bluss
commented
May 4, 2015
I'm not trying to obstruct, just stating my thoughts faithfully. I am sure many are happy with the current status of the |
aturon
commented
May 4, 2015
@bluss Oh, totally! For my part, it seemed like a pretty minor thing but still better to go through the RFC process if we have doubts. |
…25006 but #24748 is fixed, so we can remove that workaround.
alexcrichton
commented
May 4, 2015
I'd be fine removing the impl, but I also do not feel strongly one way or another. |
bstrie
commented
May 6, 2015
@bluss I'm not necessarily a fan of using My personal concern is efficiency. If we're going to favor the operation with syntax, then it has to be fast. I don't want this being a perf footgun that we have to tell people to avoid. |
bstrie
commented
May 6, 2015
Does decision on rust-lang/rfcs#839 need to happen before 1.0? |
llogiq
commented
May 6, 2015
@bstrie Please note that vector addition means something very different than vector concatenation. It could very well be argued that Languages like php, javascript, python and java which conflate addition and concatenation all have some gotchas related to it. Lua has a '_' operator for concatenation (which we unfortunately cannot copy), while PL/SQL uses '||' (which unfortunately is hardwired or, so we cannot overload it). I quite like the idea of a concatenation operator. Especially with string handling, which is quite a common task, it could simplify things a bit. However, I feel that the choice of '+' is a poor one, and a better choice will need more thought. |
bstrie
commented
May 6, 2015
@llogiq Overloading |
llogiq
commented
May 6, 2015
@bstrie yes agreed, though since bitwise and isn't used as often as arithmetic addition, it perhaps carries less connotations. As I said, finding a good solution needs more thought. If we don't want to overload an existing operator, possible candidates include ℅, ~~, ^^, ++, --, **, <>, ><, ~ (as infix) Candidates for overloading are &, |, .., << (C++ anyone) and a lot of others. |
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable
implblock. Thiscommit also audits the rest of the standard library for explicitly-
#[unstable]impl blocks. No others were removed but some annotations were changed to
#[stable]as they're defacto stable anyway.One particularly interesting
implmarked#[stable]as part of this commitis the
Add<&[T]>impl forVec<T>, which usespush_alland implicitlyclones all elements of the vector provided.
Closes#24791
[breaking-change]