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 upChange the &mut T pattern to &mut. #179
Conversation
This comment has been minimized.
This comment has been minimized.
netvl
commented
Jul 23, 2014
|
Increasing consistency is always great. +1 BTW, isn't the fact that |
This comment has been minimized.
This comment has been minimized.
|
Yes, that's exactly what causes that. |
This comment has been minimized.
This comment has been minimized.
|
+1 for the same reasons mentioned in the proposal. |
This comment has been minimized.
This comment has been minimized.
|
another potential "drawback" (though certainly some might see it as a feature of the RFC, not a drawback): a macro that expands into a pattern |
This comment has been minimized.
This comment has been minimized.
|
(Updated from feedback.) |
This comment has been minimized.
This comment has been minimized.
|
|
huonw
changed the title
RFC for changing the &mut pattern to &mut.
Change the &mut T pattern to &mut.
Jul 28, 2014
This comment has been minimized.
This comment has been minimized.
|
+1 from me, though for consistency it would be nice if supporting |
This comment has been minimized.
This comment has been minimized.
|
+1 to Kimundi's suggestion (which is mentioned in passing in the RFC Drawbacks section where it says that "disambiguating like |
This comment has been minimized.
This comment has been minimized.
|
Agreed, I'd also like to see |
This comment has been minimized.
This comment has been minimized.
|
I found exactly one instance of |
This comment has been minimized.
This comment has been minimized.
|
(Note to self: it was decided that I would collect a bit more data about how often |
This comment has been minimized.
This comment has been minimized.
|
I remain divided on this. On the one hand, I recognize that this has the potential to be a future wart, and it has only a minor impact on existing code. On the other hand, it just seems repetitive to have to write Finally, I was thinking about the plans for the For example, one could write:
Now, we could (maybe?) force you to write I see a couple of options:
|
This comment has been minimized.
This comment has been minimized.
|
(I should note though that the |
This comment has been minimized.
This comment has been minimized.
|
For a while early on, I kept writing (Of the alternatives, a single unified deref pattern also sounds appealing, if there's some satisfying syntax we could use for it, which I'm not sure of.) |
This comment has been minimized.
This comment has been minimized.
|
On Sat, Aug 09, 2014 at 08:48:57AM -0700, Gábor Lehel wrote:
Having thought about it for a bit, I think you expressed my current |
This comment has been minimized.
This comment has been minimized.
pczarn
commented
Aug 20, 2014
|
+1, find the bug in this code: let mut foo = 1u;
let bar: |&mut uint| = |&mut n| n += 100;
bar(&mut foo);
fooOne data point is not much, but someone came with this issue to the IRC. |
nrc
assigned
huonw
Sep 4, 2014
alexcrichton
force-pushed the
rust-lang:master
branch
from
6357402
to
e0acdf4
Sep 11, 2014
aturon
force-pushed the
rust-lang:master
branch
from
4c0bebf
to
b1d1bfd
Sep 16, 2014
alexcrichton
force-pushed the
rust-lang:master
branch
from
b9e2b8c
to
5020131
Oct 29, 2014
This comment has been minimized.
This comment has been minimized.
let x = 1i;
assert_eq!(x, 1i);
let &x = &1i;
assert_eq!(x, 1i);
let TupleStruct(&x) = TupleStruct(&1i);
assert_eq!(x, 1i);
// With this RFC:
let &mut TupleStruct(&x) = &mut TupleStruct(&1i);
assert_eq!(x, 1i);
// You can even work in reverse to ‘solve’ an assignment like a mathematical equation:
let &mut TupleStruct(&x) = &mut TupleStruct(&1i);
let TupleStruct(&x) = TupleStruct(&1i);
let &x = &1i;
let x = 1i;
It’s sad to see that discussion on this RFC has stalled, though—what exactly would it take to get this RFC to move further through the RFC process? This is a backwards-incompatible change, after all. |
This comment has been minimized.
This comment has been minimized.
|
Oh, whoops, forgot about this. I'll try to make some measurement and discuss with people tomorrow. |
This comment has been minimized.
This comment has been minimized.
|
Here's the things that were detected in stage1 of a plain
And here's what was detected in the crates in servo that use their
I.e. not that many. (Those are using the type checker so should detect everything in the crate, modulo conditional compilation.) |
This comment has been minimized.
This comment has been minimized.
|
(Implemented here, staging means that most of the library changes cannot be done yet, but there is two instances of the |
brson
merged commit a87116c
into
rust-lang:master
Jan 4, 2015
This comment has been minimized.
This comment has been minimized.
|
Seems to be consensus. Merged. Tracking. |
huonw commentedJul 23, 2014
No description provided.