Then why not use function calls (or types) instead of templates? The syntax is the same — just use (…) instead of <…>) and evaluation can happen more flexibly at runtime where it makes sense. Type checking would be just as strict. I really don’t see the upside to using templates here, unless constructing the HTML is somehow a gigantic bottle-neck that must happen at compile-time.
55
u/looncraz Jun 27 '20
This, frankly, looks easier than writing HTML directly... Plus free error checking... Too bad template error messages are horrendously ugly.