Skip to content
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

2019-07 LWG Motions 5, 6, and 7 #3115

Merged
merged 21 commits into from Aug 5, 2019
Merged

2019-07 LWG Motions 5, 6, and 7 #3115

merged 21 commits into from Aug 5, 2019

Conversation

zygoloid
Copy link
Member

@zygoloid zygoloid commented Aug 2, 2019

P0645R10 Text formatting
P1361R2 Integration of chrono with text formatting
P1652R1 Printf corner cases in std::format

Fixes #3009, #3010, #3011.

@zygoloid zygoloid requested a review from jwakely August 2, 2019 01:57
@tomaszkam
Copy link

tomaszkam commented Aug 2, 2019

There is major duplication of the specification between the [format.string] p10 that describes alternate form and entries in [tab:format.type.int]. In addition, these two line seem to be in-conflict with regards to appending 0 as a prefix in case if octal presentation is used ('o'). The p10 says that zero value is not prefixed, while the table does not make this exception.

Could we update the table instead, and remove the description of alternate forms in p10. Floating points types alternate form be moved to p21.

@tomaszkam
Copy link

tomaszkam commented Aug 2, 2019

The [format.string] p16 duplicates information present in the corresponding tables, as they contain none entry. In addition I that causes conflict for the priting of nan. The p22 implies that we always use nan (none is equivalent to d), while p16 says that we just ue to_chars (as if printf) and does not boil down the repersenation. Could we just refer to tables?

Also note in p23 does not seem to have any corresponding normative wording. The p16 list only const void*. (already in FIXME)

@tomaszkam
Copy link

Examples formatter specialization [format.formatter.spec] p6 and after [format.context] p8 miss second template parameter. Bot should use char (their use format_context).

Copy link
Contributor

@JohelEGP JohelEGP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few editorial improvements.

source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
\tcode{Out} models \tcode{OutputIterator<const charT\&>}, and
\tcode{formatter<}$\tcode{T}_i$\tcode{, charT>}
meets the \newoldconcept{Formatter} requirements
for each $\tcode{T}_i$ in \tcode{Args}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting functions above are missing this precondition.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but not editorial. Please file an LWG issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have been wrong.

The non v-prefixed functions are OK since the precondition is subsumed via equivalent to semantics as specified in make_format_args and family.

For the v-prefixed ones, however, they are as a Constraints: on their call site, as specified in the constructor for basic_format_arg taking a T, which is required to construct the arguments of type format_args and family.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohelEGP we're fine here, right? So this can be resolved? If not, can you please file an LWG issue for it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to file a LWG issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After all, there's no real issue here. You could theoretically dance around with decltype to get the types needed to make an expression equivalent to calling make_format_args and thus skip its preconditions, but that's not practical.

source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/time.tex Outdated Show resolved Hide resolved
zygoloid and others added 16 commits August 3, 2019 20:22
Editorial cleanups throughout.
Converted grammar to proper grammar formatting.
Removed incorrect single and double quotes that caused the wording to
be meaningless for wchar_t.
Converted some duplicated normative wording to notes.
out separate positive-integer and nonnegative-integer productions for
clarity.
presupposes that they are all present to instead specify what happens
when some or all are absent.
of format_context, as discussed on lib reflector.
Minor editorial cleanups throughout

[format.functions] Merged specification of functions with locale
parameter into existing specification rather than duplicating the
descriptions.
bool and charT in their respective tables rather than requiring the
reader to infer how to merge the integer table into the bool and charT
tables.
Co-Authored-By: Johel Ernesto Guerrero Peña <johelegp@gmail.com>
@zygoloid
Copy link
Member Author

zygoloid commented Aug 4, 2019

There is major duplication of the specification between the [format.string] p10 that describes alternate form and entries in [tab:format.type.int]. In addition, these two line seem to be in-conflict with regards to appending 0 as a prefix in case if octal presentation is used ('o'). The p10 says that zero value is not prefixed, while the table does not make this exception.

Could we update the table instead, and remove the description of alternate forms in p10. Floating points types alternate form be moved to p21.

I would prefer we do it the opposite way around. We currently have (roughly) one paragraph per component of the std-format-spec grammar and I'd like to keep it that way.

@tomaszkam
Copy link

I would prefer we do it the opposite way around. We currently have (roughly) one paragraph per component of the std-format-spec grammar and I'd like to keep it that way.

I suggest leaving the paragraph, that says that # produces an alternate form, just remove the description of meaning for specifiers, so we could have in one place. The table could just say, that alternate form uses 0X prefix, instead of #.
I have also noticed other issues, the alternate form is said to be valid for any integer presentation, but there is no description information what is the alternate form for d and n.

Copy link
Contributor

@burblebee burblebee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not done reviewing, but what I have so far...

source/utilities.tex Outdated Show resolved Hide resolved
Copy link
Contributor

@JohelEGP JohelEGP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly comments on some FIXMEs.

source/utilities.tex Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Outdated Show resolved Hide resolved
Fix the specification for '#' being different for octal integers in the
two places it's specified.
of formatting from the format specifiers for arithmetic and string
types, and make the presentation of the latter consistent with the
presentation for chrono types.
creating the impression that alignment is only applied to non-string
types.
@zygoloid
Copy link
Member Author

zygoloid commented Aug 4, 2019

Examples formatter specialization [format.formatter.spec] p6 and after [format.context] p8 miss second template parameter. Bot should use char (their use format_context).

This seems fine to me as-is; the primary template has a default argument typename charT = char.

@zygoloid
Copy link
Member Author

zygoloid commented Aug 4, 2019

There is major duplication of the specification between the [format.string] p10 that describes alternate form and entries in [tab:format.type.int]. In addition, these two line seem to be in-conflict with regards to appending 0 as a prefix in case if octal presentation is used ('o'). The p10 says that zero value is not prefixed, while the table does not make this exception.
Could we update the table instead, and remove the description of alternate forms in p10. Floating points types alternate form be moved to p21.

I would prefer we do it the opposite way around. We currently have (roughly) one paragraph per component of the std-format-spec grammar and I'd like to keep it that way.

Please take a look at the new wording; I split the difference here, defined the meaning for all cases, and (hopefully) avoided any normative duplication.

descriptions of specializations that meet those requirements.
Copy link
Contributor

@JohelEGP JohelEGP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more editorial improvements.

source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
source/utilities.tex Show resolved Hide resolved
\tcode{Out} models \tcode{OutputIterator<const charT\&>}, and
\tcode{formatter<}$\tcode{T}_i$\tcode{, charT>}
meets the \newoldconcept{Formatter} requirements
for each $\tcode{T}_i$ in \tcode{Args}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may have been wrong.

The non v-prefixed functions are OK since the precondition is subsumed via equivalent to semantics as specified in make_format_args and family.

For the v-prefixed ones, however, they are as a Constraints: on their call site, as specified in the constructor for basic_format_arg taking a T, which is required to construct the arguments of type format_args and family.

@zygoloid
Copy link
Member Author

zygoloid commented Aug 5, 2019

Despite substantial improvements from what we were given, I'm still not very happy with this wording. Nonetheless, I think it's now good enough for the CD. If there are further comments, please open issues for them and tag them with milestone post-2019-07 so that I know to address them before finalizing the CD.

@zygoloid zygoloid merged commit c6900f9 into master Aug 5, 2019
Copy link
Contributor

@burblebee burblebee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohelEGP I'll open edit issues for the remaining unresolved comments. Some of those will probably need to be forwarded to LWG however.

source/utilities.tex Outdated Show resolved Hide resolved
@burblebee
Copy link
Contributor

@JohelEGP I'll open edit issues for the remaining unresolved comments. Some of those will probably need to be forwarded to LWG however.

It's not clear to me what issues have not been resolved here. What of the following still need to be dealt with? :

  • the "FIXME which one?" issue from @JohelEGP that I can no longer find in the Latex sources,
  • the missing preconditions on the v-prefixed formatting functions mentioned by @JohelEGP which sound like weren't an issue after all,
  • the two lines that "seem to be in-conflict with regards to appending 0 as a prefix in case if octal presentation is used ('o'). The p10 says that zero value is not prefixed, while the table does not make this exception" mentioned by @tomaszkam,
  • the duplicate information present in the corresponding tables in [format.string] p16 mentioned by @tomaszkam that "contain none entry", and
  • the issue from @tomaszkam where [format.string] p16 "causes conflict for the priting of nan. The p22 implies that we always use nan (none is equivalent to d), while p16 says that we just ue to_chars (as if printf) and does not boil down the repersenation. Could we just refer to tables?".

As for the FIXMEs added by @zygoloid about the wording in the Latex sources, I presume these should be filed as LWG issues? Will someone be going thru the various FIXMEs in the motions and dealing with them?

@JohelEGP
Copy link
Contributor

JohelEGP commented Aug 6, 2019

Apart from the second point, those issues are resolved. As I said, I'll file an issue for the second point. Although I'm not too sure about the last one, @zygoloid removed the duplication, so the last 3 are solved. The first one was about the lack of specification about which format-spec a formatter::parse is called with. IIRC, now there are some non-normative notes about it.

@jensmaurer jensmaurer deleted the motions-2019-07-lwg-5-6-7 branch December 15, 2019 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[2019-07 LWG Motion 5] P0645R10 Text Formatting
4 participants