Create module-level function using mixin template?

Andy Valencia dont at spam.me
Fri Apr 25 17:24:18 UTC 2025


On Friday, 25 April 2025 at 16:59:16 UTC, monkyyy wrote:
> its extremely unclear what your trying to do my best geuss:

I want to use a mixin template to generate a top-level function.  
Like, is there a variant of the following which makes a function 
named "foo1" available?

Andy

```d
mixin template Foo(alias fn) {
     int fn() { return 1; }
}

mixin Foo!foo1;

void main() {
     import std.stdio : writeln;

     writeln(foo1());
}
```


More information about the Digitalmars-d-learn mailing list