Replies: 3 comments 2 replies
-
Mojo doesn't have macros. However there are plans to have decorators similar to Python. Mojo also allows code to be executed at compile time, for example when you use At the moment custom decorators are not supported, but it is expected that it would cover some of the needs of macros. |
Beta Was this translation helpful? Give feedback.
-
I really hope the team doesn't add macros. Just make a function instead. The code you're seeing is probably AI generated as macros have never existed in Mojo to my knowledge |
Beta Was this translation helpful? Give feedback.
-
If Python adds macros, as suggested by PEP 638, then it's guaranteed that Mojo will also add them. Till then, I don't know what the team's plans are for them. There seems to be support for user-defined statements, though. |
Beta Was this translation helpful? Give feedback.
-
Does Mojo have syntactic macros? Not parameterization but syntactic macros like Rust. There have been several articles on Medium that show supposed mojo code that is generating code via macros, but they don't seem to compile using version 24 of mojo that I have. The macro's in the articles look like:
Beta Was this translation helpful? Give feedback.
All reactions