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 17:56:04 UTC 2024
On Monday, 9 September 2024 at 17:39:46 UTC, WraithGlade wrote:
>
import std;
auto parse(char[] s)=>s[9..$-2];
void show(T,string file= __FILE__,int line=__LINE__)(T t){
writeln(File(file).byLine.drop(line-1).front.parse," == ",t);
}
void main(){
int i=3;
show(i++ + ++i * i);
show(i);
}
More information about the Digitalmars-d-learn
mailing list