Order of static this() execution?
drathier
forum.dlang.org at fi.fo
Sun Feb 23 11:55:11 UTC 2020
On Sunday, 23 February 2020 at 11:41:25 UTC, Johan Engelen wrote:
> On Sunday, 23 February 2020 at 09:59:45 UTC, drathier wrote:
>> I'm having some trouble with the order in which `static
>> this()` runs. This is the order defined in the source file,
>> numbered for convenience:
>
> To avoid confusion: you have all `static this()` in a single
> source file? Or across several source files?
>
> -Johan
They're all in a single source file. The `[template]` prints are
inside templates, like this:
```
template none(msg) {
T!(msg) none;
static this() {
none = ((std.functional.toDelegate(&batch!(msg) )))(X!(T!(msg)
));
}
}
```
The whole reason I have `static this()` is to avoid ctfe crashing
from trying to run `toDelegate` at compile time:
```
std/functional.d(1501,22): Error: dummyDel.funcptr cannot be
evaluated at compile time
```
More information about the Digitalmars-d-learn
mailing list