Skip to content

want version of dbg! using {:?} not {:#?} #82778

Closed as not planned
Closed as not planned
@ijackson

Description

@ijackson

I find the pretty-printing output from dbg! more annoying than helpful and I am privately using a version of this macro that doesn't pretty-print.

When I discussed this on the Discord several people also shared the same opinion about dbg!'s pretty-printing. (No-one really said they liked it, although that's a biased sample...) This suggests that there would be demand for a compact output version in std. While the docs for std::dbg! say the output format cannot be relied on, ISTM that changing it to remove the # would be rude (and controversial). So I suggest providing a compact version in parallel. I suggest the name dbgc! for "debug compact" but I am of course happy with whatever colour bikeshed.

If the libs team thinks this would be welcome, I will make an MR for it. If the libs team don't like this idea then fine, I can keep using my clone-and-hack :-).

While I'm here I notice that the docs suggest committing calls to dbg! is a bad idea. grepping my own codebase showed that I agree with one significant exception: I use it liberally in tests. I think it's great there and the docs could probably mention that as a good use case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions