UDA for module declaration.

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 17 01:41:21 PDT 2014


Am Wed, 17 Sep 2014 00:46:04 +0000
schrieb "IgorStepanov" <wazar at mail.ru>:

> Why not subj?
> D allows annotate with UDA the most of named symbols.
> There are three category of named symbols, which cannot be 
> annotated: module declarations, function arguments and enum 
> members.
> Enum members are trivial symbols and annotation possibility for 
> them probably does not make sense.
> However, annotation unpossibility for module declaration and 
> function arguments looks strange.
> 
> Why all this talk?
> I've created pull request for dmd, which allows UDA for modules 
> (https://github.com/D-Programming-Language/dmd/pull/3947) and 
> Walter says that I should open topic in n.g. and justify the 
> usefulness of this enhancement.
> 

In GDC we mosty use UDAs instead of pragmas, so you can do
@attribute("forceinline") void foo() {}...
or
@forceinline void foo() {}...

Obviously there are pragmas which apply to a module (e.g LDC's
nomoduleinfo pragma) which we can't represent as an UDA right now.

So
@nomoduleinfo module a;
is another possible usecase.


More information about the Digitalmars-d mailing list