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 upTracking issue for RFC 2526, "Support underscores as constant names" #54912
Comments
Centril
added
B-RFC-approved
T-lang
C-tracking-issue
labels
Oct 8, 2018
This comment has been minimized.
This comment has been minimized.
|
Ugh, seems like a legitimized hack rather than a... well, any of several proper features to which this can be generalized. At least this is a very tiny hack. |
This comment has been minimized.
This comment has been minimized.
Hehe, I agree we should generalize (to patterns) eventually but it seemed that it was much more complex from @eddyb's comments. :) |
This comment has been minimized.
This comment has been minimized.
|
looks interesting, I will give it a try! |
This comment has been minimized.
This comment has been minimized.
earthengine
commented
Oct 11, 2018
|
Can we also ensure that those gensyms get removed after before codegen? This means, the generated MIR should be removed in some MIR rounds. |
This comment has been minimized.
This comment has been minimized.
|
We don't need to remove any |
This comment has been minimized.
This comment has been minimized.
earthengine
commented
Oct 12, 2018
•
|
Fine. There is one "inconsistency" in Rust today: let _: str = *"123"; //Legal
let _v: str = *"123"; //Illegal unless unsized_rvaluesWhen implementing this, how do we want to justify const _: str = *"123";
const _v: str = *"123";Shall we repeat the inconsistency, or shall we count both valid or invalid? |
This comment has been minimized.
This comment has been minimized.
|
I'd start out with both being disallowed, since that is the current behaviour of constants. But I have no strong opinion. |
bors
added a commit
that referenced
this issue
Oct 14, 2018
Centril
added
B-unstable
B-RFC-implemented
labels
Oct 17, 2018
This comment has been minimized.
This comment has been minimized.
|
Setting earliest date for stabilization proposal to 25th november 2018 (14 days from now). We'll likely want to discuss what direction generalizations should go in before stabilizing. |
This comment has been minimized.
This comment has been minimized.
|
The RFC did not discuss Fix for the stability hole is in #55983 |
Centril
added
the
I-nominated
label
Dec 6, 2018
scottmcm
removed
the
I-nominated
label
Dec 13, 2018
This comment has been minimized.
This comment has been minimized.
|
I'm having a bit of second thoughts about this RFC. I feel like (a) the intention of The motivation of "ensure some code type-checks" is real though. I sort of like the syntax I guess I'm probably just re-raising thoughts that came up on the RFC. |
This comment has been minimized.
This comment has been minimized.
Could that be re-used for explicit promotion as @oli-obk plans it? |
This comment has been minimized.
This comment has been minimized.
|
@RalfJung seems plausible. The one concern I could see is whether there would be some conflict as |
This comment has been minimized.
This comment has been minimized.
Wouldn't that defeat the purpose of explicit promotion? |
This comment has been minimized.
This comment has been minimized.
|
With respect to a) the intention of My main worry is instead b) and c). That is, would we permit this? const (A, B): (AType, BType) = (1, 2);(this would be the natural extension of but also this? const A<T>: AType<T> = expr;and how can these be composed? If we write: const (A<T>, B<U>): (AType<U>, BType<T>) = expr;does that make any sense? I suppose that we could support generic constants when Finally, ideally, to keep the language consistent, we should keep As for supporting
|
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
DoumanAsh
commented
Dec 14, 2018
I believe it is pretty clear to user as we can use |
This comment has been minimized.
This comment has been minimized.
I don't think that's a useful interpretation. There's absolutely nothing this I agree with everything else. We should just allow constants with patterns and generic constants. We already support them inconveniently by defining a const function without arguments. |
This comment has been minimized.
This comment has been minimized.
It's not. Notably, you may only reference existing bindings. Any function calls must still be
There's plenty this would tell you:
Now.. it might be confusing to have block form entitled |
This comment has been minimized.
This comment has been minimized.
|
I don't really understand how generic constants can cause issues with unnamed consts, and AFAIK supporting |
Centril commentedOct 8, 2018
•
edited
This is a tracking issue for the RFC "Support underscores as constant names" (rust-lang/rfcs#2526).
Steps:
Unresolved questions:
None