Template instantiation syntax
Steven Schveighoffer
schveiguy at yahoo.com
Fri Oct 10 18:54:04 PDT 2008
"Walter Bright" wrote
> Jason House wrote:
>> Is it ok to chain!nested!templates? Gramatically, it's unambiguous.
>
> No. The problem is, which is it?
>
> a!b!c can be a!(b!c) or a!(b)!(c)
>
> Andrei argued that it should be the former, as that is much more useful.
> The problem is,
>
> a!b!c
>
> should be equivalent to:
>
> a!(b)!(c)
>
> which is then equivalent to:
>
> a!(b!(c))
>
> which makes no sense, because what does:
>
> a!(b,c)!(d)
>
> mean then? It becomes a morass of special cases with no comprehensible
> rules to guide us. So, we gave up, and decided to make a!b!c illegal for
> now.
a!(b)!(c) makes no sense. Does (a!(b))!(c) make any sense?
Can a template be aliased to a template symbol that still needs parameters?
I didn't think it could.
For instance, can you do something like:
class C(T) {}
template D(T)
{
alias C D;
}
Would that even compile? (don't have dmd handy)
-Steve
More information about the Digitalmars-d
mailing list