On Wed, 06 Feb 2013 21:50:36 GMT, Matej Nanut wrote:

I tried this:

- input(alias M)(string type /* ... */)
    input(id="#{M.stringof}", type="#{type}", value="#{M}" /* and so on */)

and I get an error saying "cannot use local 'varname' to non-global template".

That's a limitation of DMD right now, unfortunately. Maybe something like a global helper template

Tuple!(string, T) var(alias V, T) { return tuple(V.stringof, V); }

defined in a separate module would help a bit here. It wouldn't be as pretty, but the call could at least look like - input(var!varname, ...); instead of - input(varname, "varname", ...);.