Dynamic length string array at compile time?

Steven Schveighoffer schveiguy at gmail.com
Fri Jun 16 02:09:20 UTC 2023


On 6/15/23 9:59 PM, Mark Fisher wrote:
> Hi,
> So what if I wanted to build the strings within my library but have the 
> client append their own data, for example if I want to have declarative 
> extensions? Could this be done by using a mixin template to create the 
> strings in the client?

Well, as long as it's not *compile time*, but runtime, you can 
definitely do it. Just use shared static constructors.

As far as I know, there's no way to have the compiler build a 
compile-time list of all compiled modules to be used to build such a 
thing. You might be able to do it as a pre-build step.

One thing you could do is have a convention where some "master" module 
that knows all of the important modules to includes passes it to some 
mixin to instantiate.

-Steve


More information about the Digitalmars-d-learn mailing list