I think this is what you're looking for:
import std/macros
macro decorator(procedure: untyped): untyped =
expectKind(procedure, nnkProcDef) # 1. ensure macro accepts only
procedures
procedure[^1].add( # 2. modify the procedure body in some way
quo
https://internet-of-tomohiro.pages.dev/nim/faq.en#coding-can-i-define-custom-pragmasqmark
There may be two question:
1\. How to implement a custom Pragma macro? For example: {. Emit.}, {. link.}.
2.How to use macros to implement decorators similar to Java and Python, such as
@Authentication(userId).