Skip to content

Instantly share code, notes, and snippets.

@Beyarz
Created April 7, 2021 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Beyarz/d73b62a4cd609e54444fb1d43f26b882 to your computer and use it in GitHub Desktop.
Save Beyarz/d73b62a4cd609e54444fb1d43f26b882 to your computer and use it in GitHub Desktop.
at_compile_time.d
void main()
{
import std.algorithm, std.conv, std.stdio;
"Starting program".writeln;
// Sort a constant declaration at Compile-Time
enum a = [ 3, 1, 2, 4, 0 ];
static immutable b = sort(a);
// Print the result _during_ compilation
pragma(msg, text("Finished compilation: ", b));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment