Compile-time strings
Literals, const
and immutable
variables in module scope (that aren't initialized in a static constructor), static const
and immutable
variables in function scope, and manifest constants and enum
members, can all be known at compile time. In this section, the focus is specifically on compile-time strings. We're first going to see one more way to initialize them, then we'll see how any compile-time string can be used to generate code.
The import expression
The import
expression is quite different from the import
declaration that pulls module symbols into the current scope. This expression is used to specify any file name for the compiler to read into memory at compile time. The file will be read as text and treated as a string ...
Get Learning D now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.