Stream: ideas

Topic: Stance on macroes?


view this post on Zulip Norbert Hajagos (Dec 08 2023 at 19:54):

Hi! Since I have not seen a topic on this, and I think it is something worth talking about, I'll ask: What is your opinion on macroes inside Roc? I know it does not really fit into the philosophy because of the downsides it brings, like complexity and slower compilation speed and that's ok. But I haven't found a stance on it by the team.
I have little experience with them, so it's more for my curiosity.

Checked SQL and HTML come to my mind.
With rust, you can put html in a macro and that gets checked at comp-time. It fits good for rust. I started to think about it, when I saw templ, which is a tool (compiler) to inline html in your go code. There are many alike in the JS ecosystem, I think because the language is... inadequate to say the least, so everyone is trying to improve it, or just treat it as acompilation target. But to see go get one... Maybe a language needs that flexibility to avoid these tools.
There are ofc many more pro-s (and possibly con-s) to macroes which I'm not familliar with. What do you think?

view this post on Zulip Anton (Dec 10 2023 at 10:56):

I really don't like macros, I think they would cause a substantial increase in complexity in the compiler and in editor tooling. I avoid them in rust whenever it's reasonable to do so.

view this post on Zulip Norbert Hajagos (Dec 10 2023 at 11:10):

Fair take. Even if you would want it, there are more important, big areas for the lang & tooling to improve on right now, and compexity would delay or possibly prevent good execution on them.


Last updated: Jun 16 2026 at 16:19 UTC