Puzzled by this behavior

Paul Backus snarwin at gmail.com
Wed Jun 22 14:10:29 UTC 2022


On Wednesday, 22 June 2022 at 13:05:11 UTC, Steven Schveighoffer 
wrote:
>
> A solution that comes from a post monkyyy posted about 
> regarding function overloading inside a function (also not 
> allowed): 
> https://forum.dlang.org/post/uxycfvvbcogmbqrabghk@forum.dlang.org

If you mixin the template you can call whatever functions you 
want:

```d
import std.stdio;

void main()
{
     template funcs()
     {
         void foo() { bar(); }
         void bar() { writeln("Hello world"); }
     }
     mixin funcs;
     foo();
     bar();
}
```


More information about the Digitalmars-d mailing list