Is it possible to use templates to implement something like the `@show` macro from the Julia programming langauge in D?

monkyyy crazymonkyyy at gmail.com
Mon Sep 9 21:01:43 UTC 2024


On Monday, 9 September 2024 at 20:52:09 UTC, WraithGlade wrote:
> 
> This is not that surprising considering it uses hardcoded 
> numbers and doesn't look right.

I made it on dlang.io which does space tabs, if its not ovisous 
to a beginner, parse is ~~lazy~~ not correct, it need to do find 
substring nonsense for real code

> That seems to indicate that this code's file reading doesn't 
> actually happen in compile-time. Maybe there are compiler build 
> options for D that'll write this in in compile time though?

This is one of the old fights, you will have a bad time

"ctfe io isnt safe", if your making your own build system `-J=.` 
and string imports are an option but that will not be aviable for 
generic code; meaning you cant make something nice for the std.


More information about the Digitalmars-d-learn mailing list