Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Rust macros can do worse things than C macros can. They can execute arbitrary code at compile time.


That is only with procedural macros. Normal macros operate just by token substitutions.

Procedural macros are also special in that they are the only macros that can be 'unhygenic': creating new identifiers in the current scope that were not passed as an argument to the macro.

(Although knowing if something is a procedural macro or not is not obvious when using one in code)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: