accept @pure @nothrow @return attributes
Foo via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jan 26 08:13:40 PST 2015
On Monday, 26 January 2015 at 16:10:53 UTC, Jonathan Marler wrote:
> I agree with Jonathan's points, this solution doesn't seem like
> an improvement. If I understand the problem, we don't want to
> make every attribute use the '@' symbol because it looks bad
> and would cause a lot of code changes for sake of consistency.
> However, on the other hand, we don't want to support the new
> properties because we have to add them as keywords which would
> break code using those words and would make the language more
> restrictive (nothing can be named nogc/safe/...).
>
> 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.
You could do the same as C++ with override and final: they are
only valid attributes if they appear _after_ the function/method.
Elsewhere they are still valid as identifiers for e.g. variables.
More information about the Digitalmars-d
mailing list