Stream: beginners

Topic: ✔ Compile-time code generation story?


view this post on Zulip njlr (Jan 11 2024 at 18:51):

Is compile-time code generation considered or planned?

Basically the idea is that you can write regular program code (so here Roc) that is called by the compiler as part of the compilation process, in order to generate more code. Examples include Zig, Jai, F# type-providers

For example, you might turn a GraphQL schema into a GraphQL client at compile-time.

The advantages of this:

view this post on Zulip Richard Feldman (Jan 11 2024 at 18:53):

so there is a plan to do compile-time evaluation of constants (e.g. if I write foo = ... at the top level, that will always get evaluated at compile time), which covers some of those use cases although probably not all of them

view this post on Zulip Brendan Hansknecht (Jan 11 2024 at 19:25):

Some related discussion is in #ideas > Comptime metaprogramming for ROC

view this post on Zulip njlr (Jan 11 2024 at 19:26):

Ah yes, that's exactly what I mean. Thanks!

view this post on Zulip Notification Bot (Jan 11 2024 at 19:26):

njlr has marked this topic as resolved.


Last updated: Jul 06 2025 at 12:14 UTC