Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRename connect to join #1102
Conversation
This comment has been minimized.
This comment has been minimized.
gkoz
commented
May 2, 2015
|
|
This comment has been minimized.
This comment has been minimized.
gsingh93
commented
May 2, 2015
|
+1 |
mdinger
reviewed
May 3, 2015
| Having a deprecated method in a newborn language is not pretty. | ||
|
|
||
| If we do remove the `.connect()` method, the language becomes pretty again, but | ||
| it breaks the stability gurantee at the same time. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I approve, though I don't have a strong opinion. I do want to point out that if stability is an issue, we can have two names for the same function, and deprecate the older one. As I understand it, the core team has decided that adding methods without changing/removing existing methods is considered backwards compatible, even though there's a small chance of a name clash when adding a method. Not allowing methods to be added would be just too restrictive, since the standard library would really not be able to evolve its existing types. |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
I'd go as far as getting rid of #![feature(test)]
extern crate test;
#[bench]
fn connect(b: &mut test::Bencher) {
b.iter(|| {
["foo", "bar", "baz", "qux"].connect(" ")
});
}
#[bench]
fn concat(b: &mut test::Bencher) {
b.iter(|| {
["foo", "bar", "baz", "qux"].concat()
});
}Gives:
|
This comment has been minimized.
This comment has been minimized.
andrew-d
commented
May 3, 2015
|
|
This comment has been minimized.
This comment has been minimized.
gsingh93
commented
May 3, 2015
|
If we had done this earlier, deprecating/removing concat might have been fine, but I don't know if its worth doing it now. I don't have a strong opinion either way. |
This comment has been minimized.
This comment has been minimized.
bluss
commented
May 4, 2015
|
Full support if we can deprecate the old names before 1.0, otherwise I think it's a silly change. We can live with a difference like this. |
This comment has been minimized.
This comment has been minimized.
|
Why not deprecate even after 1.0 @bluss? |
This comment has been minimized.
This comment has been minimized.
bluss
commented
May 4, 2015
|
I'm not entirely against it, it just seems we could live with the difference instead. The name is not exactly monumental mistake. The positive sides are that deprecation is easy and the warning message should mean that almost everyone uses the non-deprecated name, but it's still another extra entry in the docs. |
This comment has been minimized.
This comment has been minimized.
|
@bluss a core team member is planning on having docs for deprecated items hidden by default |
This comment has been minimized.
This comment has been minimized.
gsingh93
commented
May 4, 2015
|
Since the trait is marked as unstable, will any code currently building with the beta actually break if the methods are removed? |
This comment has been minimized.
This comment has been minimized.
bluss
commented
May 4, 2015
|
Yes, because the methods are callable in beta (playpen link) fn main() {
println!("{}", ["foo", "bar", "baz", "qux"].connect(" "));
} |
This comment has been minimized.
This comment has been minimized.
|
@gsingh93 While the trait is unstable, the stable methods are already exported to the prelude. That's the problem! |
barosl
force-pushed the
barosl:rename-connect-to-join
branch
from
753b28c
to
568ed6a
May 5, 2015
This comment has been minimized.
This comment has been minimized.
ArtemGr
commented
May 6, 2015
|
|
This comment has been minimized.
This comment has been minimized.
tanadeau
commented
May 6, 2015
|
|
This comment has been minimized.
This comment has been minimized.
|
|
alexcrichton
assigned
aturon
May 7, 2015
alexcrichton
added
the
T-libs
label
May 18, 2015
gkoz
referenced this pull request
May 31, 2015
Open
Remove SliceConcatExt, add them as methods on [T]. #1141
Gankro
referenced this pull request
Jun 4, 2015
Closed
RFC: Allow re-exporting associated items with `use` #1150
This comment has been minimized.
This comment has been minimized.
|
The libs team has been working through the RFC backlog, and I wanted to restart discussion on this RFC. Unfortunately, since 1.0 has shipped, the calculus here is perhaps a bit different than during the original comment period. In particular, since the While I'm definitely sympathetic to the idea that matching existing precedent is good, I also feel that |
This comment has been minimized.
This comment has been minimized.
|
This seems like another great candidate for something like On Thu, Jun 11, 2015 at 10:33 AM, Aaron Turon notifications@github.com
|
This comment has been minimized.
This comment has been minimized.
|
I suggest |
This comment has been minimized.
This comment has been minimized.
ssokolow
commented
Jun 11, 2015
|
The problem with |
alexcrichton
added
the
final-comment-period
label
Jun 16, 2015
This comment has been minimized.
This comment has been minimized.
|
This RFC is now entering its week-long final comment period. |
This comment has been minimized.
This comment has been minimized.
ArtemGr
commented
Jun 17, 2015
|
|
This comment has been minimized.
This comment has been minimized.
DanielKeep
commented
Jun 18, 2015
|
This is a nasty newbie trap; I can't think of any good reason to not at least introduce |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
rtkrruvinskiy
commented
Jun 20, 2015
|
I can definitely understand the reluctance to deprecate, but I think |
This comment has been minimized.
This comment has been minimized.
|
I am somewhat confused as to why this method is defined on slices in the first place as opposed to iterators. If I want to project strings out of a collection of structs and then join them, I'd currently have to collect them into a I'd like to see a proposal for the addition of a EDIT: If the API moves to |
This comment has been minimized.
This comment has been minimized.
bluss
commented
Jun 21, 2015
|
@sfackler When slices already are present, it's a great advantage to use that, because the implementations walk them twice, once to compute the exact space needed and once to do the concatenation. When the slice is already present this is much superior, and it might even be more performant even when including a collect, depending on the number and length of the strings. So that's the benefit of slices, that doesn't preclude a method on iterators. We absolutely should opt for consistency though — I'm in favour of .connect() on an iterator if that's the name that stays. |
This comment has been minimized.
This comment has been minimized.
gkoz
commented
Jun 22, 2015
|
@bluss I don't see why it has to be a slice if a clonable iterator is sufficient. |
This comment has been minimized.
This comment has been minimized.
tafia
commented
Jun 22, 2015
|
I'm used to |
This comment has been minimized.
This comment has been minimized.
jminer
commented
Jun 24, 2015
|
|
This comment has been minimized.
This comment has been minimized.
Veedrac
commented
Jun 24, 2015
|
I'm in favour of |
This comment has been minimized.
This comment has been minimized.
Ryman
commented
Jun 24, 2015
|
@Veedrac I think the main downside currently is that rust-lang/rust#23501 is not implemented, so much of current iterator usage isn't currently cloneable? |
This comment has been minimized.
This comment has been minimized.
Veedrac
commented
Jun 24, 2015
|
@Ryman That's not much of a problem, since it still leaves us in a strictly better situation whilst we're waiting. |
This comment has been minimized.
This comment has been minimized.
|
Why does the iterator need to be clonable? Being able to allocate the space up front does not seem to be sufficiently amazing to forbid |
This comment has been minimized.
This comment has been minimized.
nstoddard
commented
Jun 25, 2015
|
|
This comment has been minimized.
This comment has been minimized.
devonhollowood
commented
Jul 1, 2015
|
I'm fine with adding |
This comment has been minimized.
This comment has been minimized.
|
The libs team did not reach consensus on this issue during this past FCP. To help focus the discussion though we think that the question of what this method is defined on (slices or iterators) is orthogonal to what it's called, so a future RFC can tweak this design but that's not quite the focus of this RFC. Additionally it's probably not worth blocking this RFC on waiting for a system for renaming methods, so the only major objection to this is that it may not be worth the cost that it incurs (e.g. deprecating a method, straddling versions is harder, etc). The support here may be enough to outweigh this, however. As a result we're going to leave this RFC in the FCP for another week. |
This comment has been minimized.
This comment has been minimized.
adwhit
commented
Jul 1, 2015
|
|
This comment has been minimized.
This comment has been minimized.
yongqli
commented
Jul 1, 2015
|
|
1 similar comment
This comment has been minimized.
This comment has been minimized.
leodasvacas
commented
Jul 3, 2015
|
|
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
nathankleyn
commented
Jul 6, 2015
|
|
alexcrichton
referenced this pull request
Jul 8, 2015
Closed
Rename SliceConcatExt::connect to join #26900
This comment has been minimized.
This comment has been minimized.
|
After this next week of FCP the libs team is now in consensus to merge this RFC, so I shall do so. Thanks again for the discussion everyone and for the RFC @barosl! |
alexcrichton
merged commit 5b9a48d
into
rust-lang:master
Jul 8, 2015
This comment has been minimized.
This comment has been minimized.
|
\0/ |
barosl commentedMay 2, 2015
Kawaii version
Related Rust issue: rust-lang/rust#24645