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 2361, "Simpler alternative dbg!() macro" #54306
Comments
Centril
added
the
T-libs
label
Sep 17, 2018
Centril
self-assigned this
Sep 17, 2018
This comment has been minimized.
This comment has been minimized.
|
I am working on this :) |
This was referenced Sep 17, 2018
Centril
added
B-RFC-approved
C-tracking-issue
labels
Sep 18, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Sep 20, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Sep 21, 2018
bors
added a commit
that referenced
this issue
Sep 23, 2018
bors
added a commit
that referenced
this issue
Sep 25, 2018
This comment has been minimized.
This comment has been minimized.
|
I just tried this out, and something that was unexpected for me was that it I didn't see this mentioned in the RFC anywhere, but it's possible this was brought up before and now falls under "Unbounded bikeshedding". I don't know if it does, but figured it might be worth sharing my experience in the off chance this hadn't been brought up before. edit (2018-09-25): I just re-read the proposal and found the Expectedlet x = 1;
let y = 2;
dbg!(x, y);Currentlet x = 1;
let y = 2;
dbg!(x);
dbg!(y); |
This comment has been minimized.
This comment has been minimized.
|
I suppose one alternative to the tuple discontinuity could be to return nothing at all when more than one argument is provided. |
This comment has been minimized.
This comment has been minimized.
|
The original RFC, rust-lang/rfcs#2173, considered it and dealt with this by giving you back a tuple; e.g. |
Centril
added
B-unstable
B-RFC-implemented
labels
Sep 25, 2018
This comment has been minimized.
This comment has been minimized.
|
And, to repeat the argument there: if |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin because if you consider I think the consistent thing to do if you want to pass multiple arguments is to consider what the result would be if you removed the prefix dbg! (a) : typeof(a)
(a) : typeof(a)
dbg! (a,) : (typeof(a),) // note the one-tuple type
(a,) : (typeof(a),) // note the one-tuple type
dbg! (a, b) : (typeof(a), typeof(b))
(a, b) : (typeof(a), typeof(b))
dbg! (a, b, c) : (typeof(a), typeof(b), typeof(c))
(a, b, c) : (typeof(a), typeof(b), typeof(c))This is symmetrical with how the language behaves and so surprises should be fewer. |
This comment has been minimized.
This comment has been minimized.
|
Exclamation mark macros invocations with parentheses are very close in syntax to function calls. The single-item tuple trailing comma syntax special case is specific to tuples, it does not apply to function calls: Whatever we do about other cases, I think |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin I inserted the space to make the consistency I'm talking about more clear ;) I think it is useful to think specifically about For example, one starts out with I do think that the behavior I noted above is more consistent than not outputting anything when multiple arguments are passed. Of course, another option is to not accept multiple arguments at all. |
This comment has been minimized.
This comment has been minimized.
I feel strongly about this. It seems that proposing otherwise was only a reaction to my earlier comment about the discontinuity between the single-arg v.s. multiple args. I’d rather live with that discontinuity than making a trailing comma significant. |
This comment has been minimized.
This comment has been minimized.
This seems like a very artificial example constructed specifically for this argument. I think it is exceedingly rare that the debugged expression just happens to be a tuple literal. The normal case is that you add |
This comment has been minimized.
This comment has been minimized.
|
If you are not tacking on However, writing The only problem arises when you remove the |
This comment has been minimized.
This comment has been minimized.
|
It's been two weeks since the last update on this thread, so in order to help keep the discussion progressing I'm making an attempt to summarize the discussion so far. My hope is that by making explicit which points are agreed / disagreed on, we can keep this proposal going. I hope I got everything right here; if I didn't let me know and I'll update this post. I hope this comes in useful. Thanks! SummaryResolved
Unresolved
DiscussionI personally hope that the parts that are agreed on are enough that they can be moved forward with, allowing to focus the remainder of the discussion on the unresolved questions. That would hopefully put the |
This comment has been minimized.
This comment has been minimized.
|
@yoshuawuyts Thanks for the summary :)
I think it should be possible to stabilize the macro as-is and then extend it further with multiple arguments, specialization (when that is stable), and other nice things in a backwards compatible way... Are there any concerns that prevent that? |
This comment has been minimized.
This comment has been minimized.
|
cc @oli-obk @alexreg As a general question... do we have any thoughts about how you debug during CTFE? It would be nice if there were some mechanism to do so in a |
This comment has been minimized.
This comment has been minimized.
|
Probably needs a separate issue, yeah. It's going to require special compiler support to get around the usual const-restrictions on this sort of thing (I/O). |
This comment has been minimized.
This comment has been minimized.
|
I agree, let's discuss this in a separate issue. We can get around the const restrictions by making the debug printer an intrinsic |
This comment has been minimized.
This comment has been minimized.
|
@oli-obk Aha yes, that crossed my mind, but I wasn't sure if it worked. Good to hear. |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin How do you feel about landing this as-is? We can revisit extensions such as multiple arguments and such later? Would be nice to have this in 1.32. :) |
This comment has been minimized.
This comment has been minimized.
|
The unresolved question is what to do about @rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Nov 21, 2018
•
|
Team member @SimonSapin has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
rfcbot
added
proposed-final-comment-period
disposition-merge
final-comment-period
and removed
proposed-final-comment-period
labels
Nov 21, 2018
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Nov 21, 2018
|
|
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Stabilization PR filed in #56395. |
This comment has been minimized.
This comment has been minimized.
|
After stabilizing, we might want to? keep this issue open for discussion about extensions and as a landing place for users who want to discuss |
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
Dec 1, 2018
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Dec 1, 2018
|
The final comment period, with a disposition to merge, as per the review above, is now complete. |
rfcbot
added
finished-final-comment-period
and removed
final-comment-period
labels
Dec 1, 2018
Centril
added a commit
to Centril/rust
that referenced
this issue
Dec 1, 2018
Centril
added a commit
to Centril/rust
that referenced
this issue
Dec 2, 2018
Centril
added a commit
to Centril/rust
that referenced
this issue
Dec 2, 2018
Centril
added a commit
to Centril/rust
that referenced
this issue
Dec 2, 2018
Centril
added a commit
to Centril/rust
that referenced
this issue
Dec 2, 2018
Centril
added a commit
to Centril/rust
that referenced
this issue
Dec 2, 2018
This comment has been minimized.
This comment has been minimized.
I don't think it should stay open. Once the RFC is implemented and stabilized, this is done. People can use IRLO threads or the RFCs repo if they want to have discussions about things or propose changes. |
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Dec 3, 2018
This comment has been minimized.
This comment has been minimized.
|
The stabilization PR was just merged so there's nothing left to do and thus we can close this issue. |
Centril commentedSep 17, 2018
•
edited
This is a tracking issue for the RFC "Simpler alternative
dbg!()macro" (rust-lang/rfcs#2361).Steps:
Unresolved questions:
There are none.