-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove hacks from ifmt and introduce fprintf #8637
Conversation
Could these be called |
Yeah I'm not really attached to the name. I figured that we chose The end result of this would be |
I was purely "arguing" that the first |
Oh, nevermind then! I kinda like the C-like names, but thankfully those are a lot easier to change than the macro names. In theory no one's actually using sprintf/fprintf by hand... |
Yeah, I think writef or write_fmt is probably best here. r=me with that change though. |
I was thinking about the names of these functions, and I figure that it'd be nice to get them right this time instead of having to revert back later. Here's what I've found: Today we have There's basically three operations we want to support: formatting into a string, formatting onto stdout, and formatting into a writer. I looked at a few other languages to see what they do
There's a pretty clear pattern here, and I'd like to not deviate too far from it. Right now, if we wanted to keep With those in mind, what would others think about moving directly to Thoughts? |
+1 on |
I don't see |
@adridu59, the main reason I don't like fmt/ffmt/sfmt could be because I'm already tainted by what rust does, but |
|
@blake2-ppc Do you have a better suggestion? To add to the references, the D doc is there: http://dlang.org/phobos/std_stdio.html#.File.write |
I have a suggestion — since you asked, I guess I am responsible to have a something to contribute together with my complaint. I will say that acrichto's summary misses python's Keep it simple, and be very deliberate with which functions or macros appear in the prelude and the default namespace. Remove Use macros
For |
After some discussion on IRC, sounds like we're all in agreement with @blake2-ppc. The changes this will make:
|
These new macros are all based on format! instead of fmt! and purely exist for bootstrapping purposes. After the next snapshot, all uses of logging will be migrated to these macros, and then after the next snapshot after that we can drop the `2` suffix on everything
Recent improvements to `&mut Trait` have made this work possible, and it solidifies that `ifmt` doesn't always have to return a string, but rather it's based around writers.
Recent improvements to
&mut Trait
have made this work possible, and it solidifies thatifmt
doesn't always have to return a string, but rather it's based around writers.