Is it possible to write custom decorators in D? Similar to python,

d

Solution

Yes, it is possible. However, in D it is called an "user defined attribute" (UDA). It has been introduced in D relatively recently, and since then people use it more and more to annotate their functions.

Problem

In python you have a function decorators. Is it possible to do something similar in D? something like: ``` @memoize("expensiveCalc") int expensiveCalc(string foo){ ///bar } ```

Original source