I don't know many languages, do decorators show up in any others? I _love_ them in Python.
static IEnumerable<int> Fibonacci()
{
int first = 0;
int second = 1;
yield return first;
yield return second;
while (true)
{
(first, second) = (second, second + first);
yield return second;
}
} def _combined(args):
return decorator(args) and original(args)
It can also be applied retroactively, not just at the decorated function's definition. This is extremely handy in the context of configuring your text editor, but I admit I wouldn't like it in a program I was working on with other people. (Basically a form of monkeypatching.)* Granted not really used for general-purpose programming like Python.
[0]:https://www.gnu.org/software/emacs/manual/html_node/elisp/Ad...
edit, sorry I've meant generators. Incidentally, it's also true for js decorators.