Adam D. Ruppe: > macro max(int a, int b) { > return a ~ " > " ~ b ~ " ? " ~ a ~ " : " ~ b; > }
In std.metastrings there's Format that allows to use a basic form of string templating, that I find a little more readable than many string concats: return a ~ " > " ~ b ~ " ? " ~ a ~ " : " ~ b; ==> Format!("return %s > %s ? %s : %s;", a, b, a, b); Or safer: Format!("return %d > %d ? %d : %d;", a, b, a, b); Or more readable, something like: return "{a} > {b} ? {a} : {b};" % (a, b, a, b); Bye, bearophile