-
-
Save idlewan/7d84e797aef10fd14bd3 to your computer and use it in GitHub Desktop.
Can I get information on previously-declared types thanks to a macro?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type TBla = tuple[a: string, b: int] | |
| macro inspect_tuple(node: expr): seq[string] = | |
| # can I get to know that the tuple type has 'a' and 'b' as fields? | |
| macro stuff(n: expr): stmt = | |
| var fields = inspect_tuple(n) | |
| stuff(TBla) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment