The API doc of both Kernel#printf and #sprintf refer to IO#printf for documentation. But the two overloads there are actually undocumented (first being empty, second saying ditto 馃槅).
(Maybe unrelated, but in the source I see that String::Formatter is used, but for some reason that class is hidden from the API doc. Maybe that could be a good place to put the documentation?)
This issue has languished, and it appears that attempts were made to resolve, but eventually got closed with no true resolution.
The methods remain undocumented:
https://crystal-lang.org/api/0.21.0/IO.html#printf%28format_string%2Cargs%3AArray%7CTuple%29%3ANil-instance-method
https://github.com/crystal-lang/crystal/blob/c2c2276ec667171af5c2347490f49acdbdc4a3ca/src/io.cr#L352-L360
What can we do to push this forward? This discussion appears to point at the Ruby docs for sprintf.
Should/can we copy the style (tables, formatting) and get that in here? @asterite You seemed to have the stronger opinion here.
I would document the IO#printf method, not the private formatter class (it's an implementation detail). I would document what is actually supported as a simple list of codes and expected types, with a few examples. Something very basic at first. Maybe see the Ruby docs and the printf man page for reference.
What's the status on this? I would like to contribute and this seems like a good starting place if nobody is taking this on. Let me know if you all would like me to start working on it.
@WazzaSoft Still up for this?
@straight-shoota Yes, I am.
@WazzaSoft go right ahead, no need to ask before making a PR.
I did not see any PR regarding this issue so I have created one.
https://github.com/crystal-lang/crystal/pull/5762
It follows both @ysbaddaden and @asterite suggestions about how to document this method.
Please take a look when you have the time and let me know if there is anything else you would me to change.
Most helpful comment
What's the status on this? I would like to contribute and this seems like a good starting place if nobody is taking this on. Let me know if you all would like me to start working on it.