Re: Conpile-Time module constructor

2022-06-19 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 19 June 2022 at 15:57:41 UTC, Ruby The Roobster wrote: On 6/19/2022 11:55 AM, Paul Backus wrote: You can do this with a `static if` check:     static if (__traits(compiles, { import mymodule; }))     {     // mymodule is included     enum compileTimeArray = ...;     }

Re: Conpile-Time module constructor

2022-06-19 Thread Ruby The Roobster via Digitalmars-d-learn
On 6/19/2022 11:55 AM, Paul Backus wrote: On Sunday, 19 June 2022 at 15:34:48 UTC, Ruby The Roobster wrote: On 6/19/2022 11:19 AM, Paul Backus wrote: On Sunday, 19 June 2022 at 14:51:26 UTC, Ruby The Roobster wrote: Is it possible to make a module constructor run at compile-time?  If so, how?

Re: Conpile-Time module constructor

2022-06-19 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 19 June 2022 at 15:34:48 UTC, Ruby The Roobster wrote: On 6/19/2022 11:19 AM, Paul Backus wrote: On Sunday, 19 June 2022 at 14:51:26 UTC, Ruby The Roobster wrote: Is it possible to make a module constructor run at compile-time?  If so, how? No, it's not. What are you trying to acc

Re: Conpile-Time module constructor

2022-06-19 Thread Ruby The Roobster via Digitalmars-d-learn
On 6/19/2022 11:19 AM, Paul Backus wrote: On Sunday, 19 June 2022 at 14:51:26 UTC, Ruby The Roobster wrote: Is it possible to make a module constructor run at compile-time?  If so, how? No, it's not. What are you trying to accomplish that lead you to ask this question? There is probably a di

Re: Conpile-Time module constructor

2022-06-19 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 19 June 2022 at 14:51:26 UTC, Ruby The Roobster wrote: Is it possible to make a module constructor run at compile-time? If so, how? No, it's not. What are you trying to accomplish that lead you to ask this question? There is probably a different way to do it without involving mod

Conpile-Time module constructor

2022-06-19 Thread Ruby The Roobster via Digitalmars-d-learn
Is it possible to make a module constructor run at compile-time? If so, how?