See https://discourse.julialang.org/t/is-there-a-way-to-determine-whether-code-is-toplevel and https://discourse.julialang.org/t/should-macros-get-an-istoplevel-or-scope-argument
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Is there a way to determine whether code is toplevel? | 3 | 956 | November 28, 2025 | |
| Should macros get an `__istoplevel__` or `__scope__` argument? | 5 | 670 | August 13, 2020 | |
| Can macros know if a variable is local or global? | 3 | 378 | August 9, 2021 | |
| How to limit scope of evaluated variable assignment? | 3 | 355 | May 11, 2023 | |
| Conditionally defining a macro | 1 | 436 | October 31, 2021 |