CaseStatement specification issue

Sergey Kozyr via Digitalmars-d digitalmars-d at puremagic.com
Wed Aug 20 02:53:23 PDT 2014


One more documentation issue. I've took sample from 
http://dlang.org/template.html

> interface Addable(T)
> {
>     final R add(this R)(T t)
>     {
>         return cast(R)this;  // cast is necessary, but safe
>     }
> }
> 
> class List(T) : Addable!T
> {
>     List remove(T t)
>     {
>         return this;
>     }
> }
> 
> void main()
> {
>     auto list = new List!int;
>     list.add(1).remove(1);  // ok
> }

I want to pay attention at line 9:
> class List(T) : Addable!T

As ClassDeclaration rule 
(http://dlang.org/class.html#ClassDeclaration) says after ':' you 
can see list of base classes. But "BaseClassList" rule allows 
only Identifier separated with comma. But here we have 
TemplateInstance instead of Identifier.
This sample code is compiled by DMD2 compiler (but interface must 
be replaced with class previously). So I think specification must 
be updated in "SuperClass" and "Interface" rules.

> SuperClass:
>    Identifier
>    TemplateInstance
>
> Interface:
>    Identifier
>    TemplateInstance

Do you want me to create a bug under issue 10233?


More information about the Digitalmars-d mailing list