deprecate deprecated?

deadalnix deadalnix at gmail.com
Wed Nov 7 06:08:42 PST 2012


Le 07/11/2012 11:42, Jacob Carlborg a écrit :
> 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
>

This is nice, but lack the possible to explore the internal of the 
function and to surgery in it :D

Still a step forward.


More information about the Digitalmars-d mailing list