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.spec] Make "specialization" a proper definition & adjust definition. #3248
Conversation
|
Yeah, I had trouble thinking of a way to describe aliases, since instantiation produces no entity, rather, replacement occurs. Another option would be to stomp out all references to "alias specializations", and replace them with something to the effect of "template-id where the template-name denotes an alias template", or something similar. |
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 feels the \defn
is editorial, but the rest is probably not. Please limit this pull request accordingly.
The Travis CI check failed. Maybe there's a space at the end of a line or so. Please fix that. |
source/templates.tex
Outdated
instantiated or explicitly specialized\iref{temp.expl.spec}. | ||
A \defn{specialization} is a class, variable, function, or class member that is either | ||
instantiated\iref{temp.inst} from a template or produced by an | ||
explicit specialization\iref{temp.expl.spec} of a 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.
I am having second thoughts about "produced by ...". In fact, an explicit specialization is a class etc. right there; it doesn't obviously "produce" one. (Oh, and "produce" sounds awkward anyway.)
maybe "... or an explicit specialization of a template."
@zygoloid ?
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.
Looks to me now.
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.
Hmm, are the "from a template" additions correct? For cases like:
template<typename T> struct X {
void f() {}
};
... is X<int>::f()
instantiated from a template, or from a member of a 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.
Also, "is either instantiated from a template or an explicit specialization of a template" is missing a verb. Or what an explicit specialization? (If this is "or is an explicit specialization", what does that mean for members of templates:
template<typename T> struct Y {
struct Z {};
};
template<> struct Y<int>::Z {};
template<> struct Y<float> { struct Z {}; };
... which of Y<int>::Z
and Y<float>::Z
are specializations? Do we really mean that the former is a specialization and the latter is not?)
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.
@zygoloid I think both of these could be addressed by saying:
A specialization is a class, variable, function, or class member that is either instantiated from a template, or a member thereof, or is an explicit specialization of a template, or member thereof.
This seems a little clunky though.
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.
Correct, but the variable itself is not
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.
Well, it was certainly intended that variable templates are also templated entities. Maybe we should simply say that a variable is an entity, then.
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.
A variable template is a template though, so it is a templates entity anyways.
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.
So, we're good with "templated entity", and all we need is an updated pull request.
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.
Updated
Specialization is the second most common term that is defined and used in [temp]. The definition in [temp.spec] p4 should be italicized to make it a proper definition. Also, the phrase " function, or class member that is [...] explicitly specialized" is incorrect: templates are explicitly specialized, not classes, functions etc (in some cases non-templates too, but rarely).
Additionally, a specialization of a alias template (such as the use here: http://eel.is/c++draft/temp.alias#2) is meaningless for non-class types. Consider the following:
A specialization is a class, function, variable, or class member. The type denoted (if you could even say that, since its replaced) by the simple-template-id
A<void>
is none of these.