On Monday, 26 January 2015 at 21:25:57 UTC, 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.

How do you tell the difference between a return type and a user attribute on the left side?

nogc myUda1 myUda2 returnType funcName() { return returnType(a); }

They are UDAs only because they are not the second-to-last id (the return type) or the last id (the function name). How do you do 'auto' inferred return types in this context, when the compiler thinks your UDA is also your return type? Also, why burden the *programmer* with having to sort this out? It's too ambiguous to read, for my taste. If I just switch the names the entire signature changes:

nogc returnType myUda1 myUda2 funcName() { return returnType(a); }

Now it's supposed to return a myUda2, just because you switched the ordering? I can see why this idea would be rejected.

Reply via email to