Talk on D at DORS/CLUC

Walter Bright newshound2 at digitalmars.com
Sun May 12 01:47:51 UTC 2024


Here's one I like:

https://github.com/dlang/dmd/blob/master/compiler/src/dmd/backend/var.d#L188

This table used to be generated by a separate C program. The C program would 
build the table, and write a .c file with the initializer for the table.

The code now demonstrates a lambda that is executed at compile time to generate 
the table. There are several examples in the file.

1. there is no need for constexpr
2. the lambda code is not emitted to the executable

The cool thing is you've got the full power of D available to generate static 
tables.


More information about the Digitalmars-d mailing list