digitalmars.dip.ideas - "all functions are templates" flag
- monkyyy (16/16) Jun 23 ```d
- Denis Feklushkin (4/8) Jun 23 All functions are templates except marked as extern or export?
- monkyyy (4/12) Jun 23 I'm not sure I follow what situation you believe it would help?
- ryuukk_ (6/23) Jun 24 the function is never called, it should never assert imo, why
- monkyyy (11/38) Jun 24 "the c stack" was made in the 1970's or whatever for very
```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`?
Jun 23
On Sunday, 23 June 2024 at 17:18:11 UTC, monkyyy wrote: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 PhobosAll functions are templates except marked as extern or export? Because some functions can be called implictly from outside and you don’t even know about it
Jun 23
On Sunday, 23 June 2024 at 20:26:14 UTC, Denis Feklushkin wrote:On Sunday, 23 June 2024 at 17:18:11 UTC, monkyyy wrote:I'm not sure I follow what situation you believe it would help? Such a flag would probably just break incremental/complex compilation.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 PhobosAll functions are templates except marked as extern or export? Because some functions can be called implictly from outside and you don’t even know about it
Jun 23
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
Jun 24
On Monday, 24 June 2024 at 13:38:31 UTC, ryuukk_ wrote:On Sunday, 23 June 2024 at 17:18:11 UTC, monkyyy wrote:"the c stack" was made in the 1970's or whatever for very different machines, headers were a helpful pre-pass for memory reasons, shared libs or incremental compilation; not only is d a little to close to c to change that default behavior but changing that to be bottom up would probably be more controversial then a gc for the "systems programming" crowd as youd need a workaround to even use c libs and current os's Eventually there are solutions to swap from a bottom up rather then a top down method, template languages must have them to work, but they came after the foundation we sit on.```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
Jun 24