accept @pure @nothrow @return attributes

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 26 14:08:55 PST 2015


On 1/26/2015 1:25 PM, Jonathan Marler wrote:
> The lexer would recognize these attributes as normal ID tokens. The grammar
> could be amended to allow a function to be decorated with keywords and generic
> id tokens.  Then the meaning of those tokens would be handled by semantic
> analysis.

Not going to do that.

> So the result would be that the lexer would see "nogc" and "safe" as
> normal id tokens (not keywords) which would be consumed as function attributes
> by the grammar.  As far as I can tell this results in the best of both worlds.
> We can omit the '@' character on function attributes like safe and nogc but they
> don't have to be added as keywords.

I strongly dislike context sensitive tokens, whether or not they are done by the 
lexer or the parser or the semantic analysis.

It's like using a nail for a cotter pin.


More information about the Digitalmars-d mailing list