On Monday, 26 January 2015 at 21:28:14 UTC, Foo wrote:
On Monday, 26 January 2015 at 21:25:57 UTC, Jonathan Marler
wrote:
On Monday, 26 January 2015 at 21:12:50 UTC, Walter Bright
wrote:
On 1/26/2015 12:45 PM, Jonathan Marler wrote:
Just because they are function attributes does not mean
they were tokenized as "keywords".
The lexer has no idea what a function attribute is or that
now it should be looking for attributes and then it should
not be.
I feel like I keep repeating myself so I'm just going to
copy/paste.
If the grammar supported decorating a function with a list of
id
tokens (not just keywords), then you could implement a
variation
on the c++ solution of allowing "override" and "final" after a
function signature.
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.
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.
Right. That's was what I meant.
Same thing could be possible for body...
Ya same thing applies to "body". I'm surprised no one has given
a reason why it wasn't done this way.