"all functions are templates" flag

ryuukk_ ryuukk.dev at gmail.com
Mon Jun 24 13:38:31 UTC 2024


On Sunday, 23 June 2024 at 17:18:11 UTC, monkyyy wrote:
> ```d
> import std;
> auto foo()(){static assert(0);}
> auto bar(){static assert(0);}
> void main(){
>     "hello world".writeln;
> }
> ```
>
> In the above code, foo doesnt break, bar does.
>
> In the vain of removing the "unreachable statement" error and 
> reducing phoboes interdependence( 
> https://forum.dlang.org/post/xiprhwrxykatbhlhhcru@forum.dlang.org), have a debug flag that will treat bar as foo, with an empty template header. So only used code breaks compiles.
>
> In wasm with a broken libc, phoboes is unusable, for silly 
> reasons like t_time being undefined so I cant use anything that 
> imports chains to core.*, which as far as I know is all of 
> Phobos
>
> `-templateify`?

the function is never called, it should never assert imo, why 
even compile unused functions?, sounds like the compiler is 
wasting time, but i am not a compiler dev so i am clueless here, 
just wanted to point that out, hopefully someone could enlighten 
us


More information about the dip.ideas mailing list