Hi,
I've been lurking around in the forums for quite a long time now,
but only recently tried D for a bit more than some trivial
experimentation. Though the documentation of external libraries
and the tooling itself is far from a commercial solution in
quality, I understand that it's a community effort, so my
experience is good in overall.
I really like what I've seen of vibe.d so far. The only strange
part was Diet templates: though the concept is not bad at all,
it's not practical. Unless you're also a good web designer, you
usually start from existing HTML templates, using Diet templates
would require a complete rewrite in such cases.
I've seen in some forums that the Temple template engine may be
more practical in such cases and it has vibe.d support, so I gave
it a try. I have the following function mapped to some URL:
void hello(HTTPServerRequest req, HTTPServerResponse res)
{
auto ctx = new TempleContext;
ctx.username = "testing";
// Gives compile error
// renderTemple!("Hello <%= var.username %>")(res, ctx);
// I'd expect this behaves the same, but works fine
string content = compile_temple!("Hello <%= var.username
%>").toString(ctx);
res.writeBody(content);
}
In the code above, function renderTemplate() gives the following
compile error which I could not solve so far:
Compiling using dmd...
Compiling Temple with Vibed support
TempleFunc-mixin-1(51): Error: static assert "Filter does not
have a case that accepts a VariantN!32LU"
TempleFunc-mixin-1(17):instantiated from here:
__temple_buff_filtered_put!(VariantN!32LU)
../../../.dub/packages/temple-0.7.3/src/temple/package.d:47:
InlineTemplate(1):instantiated from here:
__temple_put_expr!(VariantN!32LU)
src/temple/temple.d(77):instantiated from here:
TempleFunc!(TempleHtmlFilter)
../../../.dub/packages/temple-0.7.3/src/temple/package.d(43):
... (2 instantiations, -v to show) ...
../../../.dub/packages/temple-0.7.3/src/temple/vibe.d(53):
instantiated from here: Temple!("Hello <%= var.username %>",
TempleHtmlFilter)
source/app.d(...):instantiated from here:
renderTemple!("Hello <%= var.username %>", TempleContext)
I'm using dub to build and run the application. Am I doing
something wrong here, or is it something environmental like a
library version conflict or wrong D deployment?
thanks
István