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

Crystal has macros which is the metaprogramming for static/compiled languages. And last time I checked, there are way more things that you can do with Crystal macros than Rust's macros. And crystal's macros feel very familiar to the language itself, are easy to understand and use them whereas Rust's macros..


According to [1], Crystal Macros "receive AST nodes at compile-time and produce code that is pasted into a program." This is basically the same as Rust procedural macros[2]. You're probably thinking of "Macros by example"[3]

[1] https://crystal-lang.org/reference/syntax_and_semantics/macr...

[2] https://doc.rust-lang.org/reference/procedural-macros.html

[3] https://doc.rust-lang.org/reference/macros-by-example.html


Being able to receive AST in crystal is only good. However have a look here [1], 90% of your macros are covered with those helpers. In Rust doing the same things are either more difficult or impossible. For instance, I wanted in rust to inject allow/warn kind of derives based in env var. Nope.

[1] https://crystal-lang.org/reference/syntax_and_semantics/macr...




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: