How to customize a top-level Pragma

2024-04-06 Thread Niminem
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

How to customize a top-level Pragma

2024-04-06 Thread demotomohiro
https://internet-of-tomohiro.pages.dev/nim/faq.en#coding-can-i-define-custom-pragmasqmark

How to customize a top-level Pragma

2024-04-05 Thread mabon
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).