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
[temp.arg.explicit,temp.mem] Clarify note about explicit template arg… #2043
Conversation
20b1a6d
to
facc3ad
Compare
source/templates.tex
Outdated
@@ -2472,9 +2472,11 @@ | |||
\end{codeblock} | |||
\end{example} | |||
\begin{note} | |||
%% Ed. note: Using \iref would cause an overflowing \hbox; changing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we'd fixed \iref
so that we can break before it, just with a high penalty? :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except that, when I tried it, it didn't work in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could add an optional parameter to \iref
to specify its \nolinebreak
penalty. I'm sad that it doesn't "just work" here; it definitely does work in other places, such as [class.dtor]p14, but IIRC turning down the line break penalty any further globally causes TeX to wrap inline references even in places where it's unnecessary to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From https://tex.stackexchange.com/questions/94217/what-is-the-difference-between-nobreak-and-nolinebreak it looks like we're probably effectively using \penalty 301
currently (that's for article, but I'd guess memoir is probably not very different). Maybe we could binary search to find whatever value works in this case and try changing \iref
to use something like that.
source/templates.tex
Outdated
name, and because conversion member function templates and constructor | ||
member function templates are called without using a function name, | ||
name (\ref{temp.arg.explicit}), and because conversion member function templates\iref{class.conv.fct} | ||
are named without using a function name, | ||
there is no way to provide an explicit template argument list for these | ||
function templates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording that remains here is wrong, isn't it? The reason you can't provide an explicit template argument list to a conversion function is simply because grammar productions for template-id do not include a production for a conversion-function-id followed by a template-argument-list. (The reason for that is presumably the visual ambiguity between template arguments of the conversion function and template arguments of its type, combined with there being no way to write operator T </*T=*/int>
, since you can't name T
.) But it seems simply wrong to say that conversion member function templates are called without using a function name; they can be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like these "because" sentences in any case.
Updated, and rephrased to avoid the overfull \hbox. The note in [temp.mem] now does conversion function templates, the note in [temp.arg.explicit] only does constructors. |
source/templates.tex
Outdated
template name, and because conversion member function templates and | ||
constructor member function templates are called without using a | ||
template name, and because | ||
constructor member function templates\iref{class.ctor} are named without using a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the change "are called" -> "are named" here intentional? I think it's clear that (for example) the expression A()
calls a constructor without using a function name, and more generally, there is no syntax to call a constructor using a function name. However, it's not clear to me that template<typename T> A::A(T t)
names the constructor without using a function name -- in that context, A::A
names the constructor, and the constructor is a function, so arguably A::A
is a function name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[temp.arg.explicit] p2 lists the circumstances under which an explicit template argument list can be supplied for a function template. "A function is called" is just one of five options. I agree that "named" is bad term here, though, because we use "naming the constructor" when we want to weasel-word around the fact that constructors don't have names to start with. p1 talks about "function template name", and the note wants to highlight that a strict reading of "name" is required here (and thus constructors can't have template argument lists). Oh, and [class.qual] p2 has a lot of words to avoid mentioning the phrase "function name" for constructors, in particular for your declaration example.
I'll add a cross-reference.
source/templates.tex
Outdated
There is no syntax to form a \grammarterm{template-id}\iref{temp.names} | ||
by providing an explicit template argument | ||
list\iref{temp.arg.explicit} for a conversion member function | ||
template\iref{class.conv.fct}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"conversion member function template" is an awkward phrase, as it splits the term "conversion function". The "member" here seems redundant, since every conversion function [template] is already a member function [template]. So how about replacing that with just "conversion function template"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was there before...
source/templates.tex
Outdated
template name, and because conversion member function templates and | ||
constructor member function templates are called without using a | ||
template name, and because | ||
constructor member function templates\iref{class.ctor} are named without using a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of "constructor member function templates", I think "constructor templates" would be clearer and easier to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, pre-existing junk.
Updated. |
…uments for conversion function templates and constructor templates.
…uments
for conversion function templates and constructor templates.
Fixes #2041.