Template instantiation syntax
Sergey Gromov
snake.scaly at gmail.com
Fri Oct 10 19:39:36 PDT 2008
Fri, 10 Oct 2008 16:39:00 -0700,
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)
Why is this necessary? If a binary ! is right-associative and of a very
high priority then a!b!c binds correctly:
TemplateInstance:
TemplateIdentifer !( TemplateArgumentList )
TemplateIdentifer ! Identifier
TemplateIdentifer ! TemplateInstance
so that even a!b!c!(x,y) works as a!(b!(c!(x,y))), but a!(b)!(c) is not
accepted.
More information about the Digitalmars-d
mailing list