Interested in contributing to D!

Basile B. b2.temp at gmx.com
Sun Dec 27 14:17:47 UTC 2020


On Sunday, 27 December 2020 at 13:43:24 UTC, Pallavering wrote:
> Hello!
>
> [...]
>
> Recently, I came across the 
> [libdparse](https://github.com/dlang-community/libdparse) 
> library and (through a couple clicks) stumbled upon 
> [this](https://github.com/dlang-community/libdparse/issues/370#issuecomment-531049896).
> Specifically, this snippet:
>
>     public @safe @wow pure void prefixAttrs(int x) {}
>     public void suffixAttrs(int x) @safe @wow pure {}

When the attributes are prefix this is more some scope flags that 
are pushed before the function declaration and pop after, e.g 
pretty much like

       public{ @safe{ @wow{ pure{ void prefixAttrs(int x) {} } } }}

Now let's look at the specs. Here in DeclDefs [1] you can see 
that AttributeSpecifier is parsed before Declaration which 
contains FunctionDeclaration. So dparse is right toward the specs.

[1] https://dlang.org/spec/grammar.html




More information about the Digitalmars-d mailing list