Posted Sat, 03 Nov 2012 11:41:13 +0100 in reply to
denizzzka
Reply
Am 02.11.2012 23:37, schrieb denizzzka:
renderCompat syntax is ugly :-(
And it don't work for me:
res.renderCompat!("sellingnewcreated.dt", typeid(req), req, typeid(a),
a) // line 38
(Variant(req), Variant(a)); // line 39
source/app.d(39): Error: variable req cannot be read at compile time
source/app.d(39): Error: variable a cannot be read at compile time
May be you can write mixin or template wrapper for renderCompat?
The problem is that passing local variable aliases to a template (which
render!()
does) can still result in memory corruption or strange
linker errors, although the corresponding DMD bug was marked as fixed.
Now that a complete fix is not really in sight, it may actually be worth
to at least improve the renderCompat!()
syntax a bit.
For the current version typeof
and variable name strings are required:
res.renderCompat!("selling_new_created.dt",
typeof(req), "req", typeof(a), "a")
(Variant(req), Variant(a));
I guess it should be quite possible at least reduce the syntax to this:
res.renderCompat!("selling_new_created.dt", "req", "a")(req, a);
I'll see about this...