accept @pure @nothrow @return attributes

via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 28 07:54:45 PST 2015


On Monday, 26 January 2015 at 21:28:51 UTC, Zach the Mystic wrote:
> On Monday, 26 January 2015 at 16:10:53 UTC, Jonathan Marler 
> wrote:
>> Assuming I understand the problem, couldn't we modify the 
>> language grammar to support more attributes without making 
>> them keywords?  Then we can omit the '@' on future code (and 
>> fix the old code if we want) and we don't have to litter the 
>> language with new keywords.
>>
>> I understand that doing this may be fairly complicated.  This 
>> may create some ambiguities in the grammar that would need to 
>> be handled carefully, but if it can work I think this would be 
>> a good option.
>
> I think the short answer is that it's WAY too complicated for 
> the benefit. Also, why burden the syntax highlighter, let alone 
> the human reader, with ambiguities like this?

I don't agree that it's complicated, it's just not the most 
beautiful thing. But it is already used in several places.

As for the syntax highlighters, any identifiers between `)` and 
`{`, or `)` and `;` can be treated as function attributes, except 
those that are already known to be keywords. No problem there. 
And for human readers it would be even easier, because now all 
function attributes have to be placed on the right side of the 
declaration.


More information about the Digitalmars-d mailing list