Thread overview | |||||
---|---|---|---|---|---|
|
November 13, 2006 alias class | ||||
---|---|---|---|---|
| ||||
Hello. While trying to get some piece of parser code be covered by tests (I'm translating the DMD parser to Java) I found that this is possible: --- alias class Foo { } typedef class Bar { } --- What those attributes in a class suppose to mean? Just curiosity. |
November 13, 2006 Re: alias class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ary Manzana |
Ary Manzana wrote:
> Hello.
>
> While trying to get some piece of parser code be covered by tests (I'm translating the DMD parser to Java) I found that this is possible:
>
> ---
> alias class Foo {
> }
>
> typedef class Bar {
> }
> ---
>
> What those attributes in a class suppose to mean? Just curiosity.
The grammar for alias and typedef is
alias Declaration
I don't know what the above means, I think it's not legal D code, I think the compiler would complain about it, but, at the semantic pass. At least that's what I have assumed.
|
November 13, 2006 Re: alias class | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hasan Aljudy | == Quote from Hasan Aljudy (hasan.aljudy@gmail.com)'s article
> Ary Manzana wrote:
> > Hello.
> >
> > While trying to get some piece of parser code be covered by tests (I'm translating the DMD parser to Java) I found that this is possible:
> >
> > ---
> > alias class Foo {
> > }
> >
> > typedef class Bar {
> > }
> > ---
> >
> > What those attributes in a class suppose to mean? Just curiosity.
> The grammar for alias and typedef is
> alias Declaration
> I don't know what the above means, I think it's not legal D code, I
> think the compiler would complain about it, but, at the semantic pass.
> At least that's what I have assumed.
I don't know what this code is supposed to mean, but it seems to compile and run:
import std.stdio : writefln;
alias class Foo {}
typedef class Bar {}
void main()
{
Foo c = new Foo();
writefln("Looks like nonsense to me, but the compiler doesn't mind.");
}
|
Copyright © 1999-2021 by the D Language Foundation