Playback speed
Share post
Share post at current time

Paid episode

The full episode is only available to paid subscribers of Digital Grove

Codebase Walkthrough: Using The Metaprogram

Walking through the structure and basic usage of the codebase's metaprogram, which allows for arbitrary compile-time execution, code generation, and code introspection.

In this video, I walk through the structure and features of the codebase metaprogram, located in the metagen layer. This simple program, and its trivial usage in the codebase build.bat file, allows for arbitrary compile-time execution, introspection over the codebase, and compile-time code or data generation. It’s a simple setup, but it provides many capabilities that many assert can only be provided by a compiler or language designer.

By inserting itself into the build, the codebase is not dependent on a compiler or language designer providing the right features—it simply has the space of compile-time execution available for its own computation.

This model has other many notable benefits, which compiler-executed metaprograms lack—the metaprogram can be debugged like a normal executable with normal debug information, and it can run as a native program at full speed; it does not need to execute within a bizarre pure-functional type language, or within a virtual execution environment, it is just regular code, which analyzes and produces text.

This post is for paid subscribers