On Saturday, 21 April 2018 at 19:51:05 UTC, Simen Kjærås wrote:
On Saturday, 21 April 2018 at 11:23:33 UTC, Alex wrote:
So, do you mean, that the constraint belongs to the interface of a template?

Not necessarily - it depends on what you want to achieve. The only thing I mean is that the code clearly defines two templates in one case (and chooses which template to instantiate based on the arguments), and one template in the other (and chooses the contents of that template based on the arguments).

This is wrong, at least as I understand this:
Lowering rules apply. These rules define a set of semantic equivalent constructs. I expect all semantic equivalent constructs to be handled equivalent.**


Sure, the end result may be similar*, but how it works in the language is clearly defined, and different between the two cases.

*In this case, there are important differences - in the first case the template itself is marked with a UDA, in the second the enum member is.
This is a good point. But you won't be able to get the UDA from an uninstantiated template will you? If you will, then, I'm wrong, I think...

** So my point is: If you can transform some construct into another one by lowering rules, than
- either: you can't define an overload
- or: you can define same overloads on both forms.
[1]

In the first case foo!"c" will fail to instantiate, in the second it won't.

This is due, I didn't add
´´´
else
{
    assert(0);
}
´´´
sorry for this.

[1] http://www.drdobbs.com/architecture-and-design/so-you-want-to-write-your-own-language/240165488?pgno=2

Reply via email to