On 2012-11-07 04:41, Walter Bright wrote:
It would be interesting to see where those pain points are, and whether
a general "hook" mechanism for user plugins would be a good idea.
I think that with UDA in combination with AST macros it could work.
@deprecated("don't use this feature any more") int foo (int a) { return
a + 3; }
In this case @deprecated would be a macro annotation/attribute or a
declaration macro or what to call it. The macro would receive the AST of
the declared language element, in this case the function. The AST return
by the macro would be inserted instead of the declared function "foo".
The @deprecated macro would return an AST for the following code:
int foo (int a)
{
static assert(false, "don't use this feature any more"); // use
this for error
// pragma(msg, "don't use this feature any more"); // use this for
warning
return a + 3;
}
Have a look at Scala macro annotations:
http://scalamacros.org/future.html
--
/Jacob Carlborg