Uh oh!
There was an error while loading. Please reload this page.
Stabilize format_args_ln! - #97658
Conversation
rust-highfive
commented
Jun 2, 2022
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
rust-highfive
commented
Jun 2, 2022
r? @m-ou-se (rust-highfive has picked a reviewer for you, use r? to override) |
Shouldn't it be format_args_ln like the other macros: println, writeln? (arguably even without the underscore) |
bstrie
commented
Jun 2, 2022
This seems awfully specific. Since the stdlib implements formatting macros, can we see a diff of what sort of improvement resulted/would result from using this? |
This came up on Zulip as well. So, I personally think this should keep its current name, but I also don't care strongly and would not block changing it if others feel it should be changed. |
joshtriplett
commented
Jun 2, 2022
std already uses this in println and writeln, via Currently, if you |
bstrie
commented
Jun 2, 2022
I'm generally against new macros being defined in the stdlib root, and especially so if it's as niche as this one. Can we define it in |
inquisitivecrystal
commented
Jun 2, 2022
While it may make sense for it to be |
joshtriplett
commented
Jun 2, 2022
That seems likely to be a persistent source of confusion, since format_args is in the root. |
yoshuawuyts
commented
Jun 3, 2022
I've been meaning to finish up the RFC to (re-)export macros from their logical submodules. We're already well north of 50 macros exported from the
Using this approach at every step of the way all Footnotes
|
Rather, it just means that we should be exposing format_args from std::fmt as well. The exposure of macros from the crate root is a legacy technical limitation that we are no longer beholden to, so let's not perpetuate the mistake now that it is no longer required. |
I'm not seeing how this solves the problem? If format_args is exposed from both the crate root and std::fmt, then full consistency would require that this macro also be exposed from both. Otherwise, the set of places they're accessible from would be inconsistent, and could potentially cause confusion. |
39eba2f to
351a13cCompare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
76379a7 to
f9c8876Compare
This comment has been minimized.
This comment has been minimized.
This provides consistency with `writeln!` and `println!` and `eprintln!`.
`format_args_ln!` is generally useful for implementations of formatting macros, and it has clear semantics and a clear interface.
f9c8876 to
ef7c7a1Comparejoshtriplett
commented
Jun 5, 2022
I've rewritten this PR to rename |
scottmcm
commented
Jun 8, 2022
I am totally fine with But because of https://internals.rust-lang.org/t/null-consistency/16767?u=scottmcm, I was looking at https://www.unicode.org/Public/14.0.0/ucd/NameAliases.txt today: Where, interestingly, I think consistency with |
joshtriplett
commented
Jun 8, 2022
@scottmcm That was my original argument as well, but I think consistency with println and writeln is more important. |
m-ou-se
commented
Jun 8, 2022
I'm not convinced we should stabilize this. I'd prefer if we worked on something like #78356, to make sure that
|
joshtriplett
commented
Jun 8, 2022
I would love to see further optimizations to format_args, but I don't think that future possibility obsoletes this. This is a simple solution that exists today and that we're already using ourselves, and that other libraries would like to make use of. If we find a more general solution in the future, that wouldn't obsolete this common case any more than it would obsolete writeln or println. |
liigo
commented
Jul 7, 2022
|
PG-MANA
commented
Jul 16, 2022
I hope When I write bare metal programs with the core crate, I must implement ( As already commented, we can implement fnprint_args(args: fmt::Arguments){/* */}macro_rules! println {($fmt:expr) => ($crate::print_args(format_args_nl!($fmt)));($fmt:expr, $($arg:tt)*) => ($crate::print_args(format_args_nl!($fmt, $($arg)*)));}fnmain(){let number = 1;println!("The number is {number}");} |
bors
commented
Jul 19, 2022
☔ The latest upstream changes (presumably #99451) made this pull request unmergeable. Please resolve the merge conflicts. |
bstrie
commented
Jul 22, 2022
My nod towards consistency is that, if people want to be consistent, then expose both of these from |
liigo
commented
Jul 25, 2022
I suggest providing the new functionality in syntax of
and maybe and then there is no controversy about its naming and namespace, just stay with I don't think it's a widely used macro, so a little more complex syntax doesn't matter IMO. |
est31
commented
Aug 27, 2022
👋 Hello, I'm writing this comment in this stabilization PR to notify you, the authors of this PR, that #100591 has been merged, which implemented a change in how features are stabilized. Your PR has been filed before the change, so will likely require modifications in order to comply with the new rules. I recommend you to:
That's it! The If you have any questions, feel free to drop by the zulip stream, or ping me directly in this PR's thread. Thanks! 👋 |
joshtriplett
commented
Nov 14, 2022
I would love to revisit this. It seems like there are two categories of concerns here. First, there are the various bikesheddings of what this should be named. I really don't have a strong opinion here, apart from wanting consistency. Second, there's the question of whether to have this at all. On that point, it feels like this is being held to a standard that, for instance, I would argue that even if we have a version of |
schultetwin1
commented
Apr 6, 2023
I'd like to add a specific +1 to this. When developing in a |
joshtriplett
commented
Apr 7, 2023
schultetwin1
commented
Apr 7, 2023
Gotcha, thanks for the pointer Josh! |
m-ou-se
commented
May 1, 2023
#111060 shows that |
format_args_ln!(formerlyformat_args_nl!) is generally useful for implementations of formatting macros, and it has clear semantics and a clear interface.