Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature request: Scope macros in prelude #272
Comments
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Jul 24, 2018
|
The practice of using globs to specify items does not leave you with less cognitive load as author, but does add cognitive load for readers not yet familiar with the full set of log macros. |
This comment has been minimized.
This comment has been minimized.
tkilbourn
commented
Aug 13, 2018
|
I just ran into this, converting a medium-sized crate with lots of modules. |
This comment has been minimized.
This comment has been minimized.
cavedweller
commented
Aug 14, 2018
|
I would also really like to have the macros namespaced so I could glob import them. This is not something I would expect to confuse people. |
This comment has been minimized.
This comment has been minimized.
|
The intention for the |
This comment has been minimized.
This comment has been minimized.
cavedweller
commented
Aug 14, 2018
•
|
@alexcrichton I think the comment here is that frequently we would frequently find ourselves with
I added |
This comment has been minimized.
This comment has been minimized.
|
Ah ok, thanks for clarifying! Seems like a reasonable feature request to me! |
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Aug 15, 2018
|
@cavedweller and others reading that: a better way is to import all macros you ‘may’ use and allow unused imports on that import statement. |
This comment has been minimized.
This comment has been minimized.
cavedweller
commented
Aug 15, 2018
•
|
@sanmai-NL I think I disagree, for better or for worse, allows are significantly more confusing for a person onboarding to a codebase. They need to figure out what is special about that specific import, and then the statement doesn't get cleaned up when all the macros are actually all in use. I don't think something like the import of logging utilities should take two lines either. |
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Aug 16, 2018
•
|
Any static analysis policy exception should of course be documented in a comment. Not cleaning the exception up would be proper in your case, it still applies, just happens to be inapplicable at some time, but could become applicable after a few changes. If you care about this then I’d suggest to just import what you use and change imports as necessary. Complaining about the number of lines taken to achieve something (3 lines vs 1) is the kind of attitude that triggers me to put out this criticism. The job of a programmer is to produce quality software not type as little as possible (even though most of it is copy-paste, boilerplate stuff). |
mehcode commentedMay 23, 2018
Using the Rust 2018 preview mode in nightly I find myself wanting to just import all the log macros in one go vs. having to name them explicitly.