[dmd-internals] Why do AttribDeclarations exist?

Daniel Murphy yebblies at gmail.com
Fri Feb 17 03:19:40 PST 2012


On Fri, Feb 17, 2012 at 9:44 PM, Don Clugston <dclugston at googlemail.com> wrote:
> Yes, but that's dealt with in StorageDeclaration::semantic, which, as
> far as I can tell, does nothing which couldn't be done better in the
> parser.

Good point, I can't think of any way that storage classes depend on semantic.

> I think the existing approach is the reason the compiler has accepts
> nonsensical combinations of attributes without complaint.

Yeah, I never realized this could be done in the parser - I thought
storage classes etc had to be propagated/filtered during semantic.

I think the rest of what I said was due to this misunderstanding.

One problem I've run into with the current setup is that
AttribDeclarations don't exist by the time semantic is run on the
members.  This means that eg a PragmaDeclaration has to inject
information recursively into its members, or add it to the scope.
Having declarations be able to query the attributes attached to it
would make some things I've tried to do much easier.

So yeah, if it can be done in the parser, I see no reason why it
shouldn't be done in the parser.


More information about the dmd-internals mailing list