DIP56 - inlining

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 4 02:57:24 PST 2015


Am Wed, 04 Feb 2015 06:59:52 +0000
schrieb "Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>:

> but I agree that the pragma syntax is ugly, but "@attribute" is 
> also ugly.
> 
> Maybe better to reserve "@_word" so that they cannot be used for 
> UDA and let all pragmas start with "@_":

That's not necessary. For GDC you can do this:

alias forceinline = Attribute!("forceinline");
(I don't remember the exact syntax but you can use an alias)

Then you can simply do
@forceinline void test (){};

There's no need to reserve @_ as UDAs follow normal lookup rules.
@forceinline consflicts with some other UDA? Than use the full name,
renamed imports, add an alias, ...

That's a huge benefit of UDAs.



More information about the Digitalmars-d mailing list