Thread overview
[Issue 15227] std.format undocumented grammar
Oct 27, 2015
Vladimir Panteleev
Oct 29, 2015
Jack Stouffer
Nov 08, 2015
Doug Nickerson
Nov 08, 2015
Doug Nickerson
Mar 31, 2018
Seb
Feb 13, 2021
Walter Bright
Mar 29, 2021
Dlang Bot
Mar 31, 2021
Dlang Bot
October 27, 2015
https://issues.dlang.org/show_bug.cgi?id=15227

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jack@jackstouffer.com,
                   |                            |rburners@gmail.com,
                   |                            |thecybershadow@gmail.com
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=3479

--- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> ---
The code seems to have been added by Andrei Alexandrescu himself back in 2011:

https://github.com/D-Programming-Language/phobos/commit/e068168273e4200bbf0c44e5ebba6a697a714b97 https://issues.dlang.org/show_bug.cgi?id=3479

CCing our diligent documentation writers.

--
October 29, 2015
https://issues.dlang.org/show_bug.cgi?id=15227

--- Comment #2 from Jack Stouffer <jack@jackstouffer.com> ---
In addition to the above problems, the examples in text should be moved to unit test examples.

--
November 08, 2015
https://issues.dlang.org/show_bug.cgi?id=15227

--- Comment #3 from Doug Nickerson <Tachyon165@gmail.com> ---
In addition to the undocumented syntax I've further noticed:
- grammar for 'Integer' technically allows leading 0's and disallows negative
integers
- 'Integer' is used in the grammar for both non-negative (Position) and
negative (Width, Precision) purposes
- the 'r' (raw) and 'u' (unsigned) format spec characters are not documented
anywhere (neither in the grammar or the rest of the text)

That last bullet is probably more important than any other.

Caveat on the original issue: there is indeed a hyperlink very early on in the formattedWrite documentation, which goes to an external page that does explain the positional syntax/semantics: "%n$" and "*m$" but not the forms involving ':'

Incidentally, that page (2004 edition) indicates a newer version is available: http://pubs.opengroup.org/onlinepubs/9699919799/  (2013 edition).  However, it doesn't appear to have anything new regarding positional notation.

Related question: is there a reason, or should std.format support the 'i', 'p', or 'n' format spec characters from the *printf family of functions?

--
November 08, 2015
https://issues.dlang.org/show_bug.cgi?id=15227

--- Comment #4 from Doug Nickerson <Tachyon165@gmail.com> ---
Correction: the 2013 edition link should be: http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html

--
March 31, 2018
https://issues.dlang.org/show_bug.cgi?id=15227

Seb <greensunny12@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |bootcamp
                 CC|                            |greensunny12@gmail.com

--
February 13, 2021
https://issues.dlang.org/show_bug.cgi?id=15227

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=3248

--
March 29, 2021
https://issues.dlang.org/show_bug.cgi?id=15227

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
@berni44 created dlang/phobos pull request #7927 "Fix Issue 15227 - std.format undocumented grammar" fixing this issue:

- Fix Issue 15227 - std.format undocumented grammar

https://github.com/dlang/phobos/pull/7927

--
March 31, 2021
https://issues.dlang.org/show_bug.cgi?id=15227

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/phobos pull request #7927 "Fix Issue 15227 - std.format undocumented grammar" was merged into master:

- d5cb431b70935a87b926dd7db3fe2241e6300331 by berni44:
  Fix Issue 15227 - std.format undocumented grammar

https://github.com/dlang/phobos/pull/7927

--