Boost logo

Boost :

From: Jeff Garland (azswdude_at_[hidden])
Date: 2023-02-19 17:01:46


On Sat, Feb 18, 2023 at 4:16 PM Jens Weller via Boost <boost_at_[hidden]>
wrote:

>
> So I've spend some time to read the debate and followed along, wondering
> if I'd write this review, as I do actually have a use case. I'm a boostache
> user.
> In 2014, during C++now this library was created and in later works
> extended, it is exactly what this new mustache library does: a mustache
> library for boost.
> boostache is still on github for you to see
> https://github.com/cierelabs/boostache
>
> Sadly, boostache never went to review and has been a little known library
> used by very few users afaik. My use case is that this powers the part of
> the CMS where text templates are being used to create the actual website in
> html code.
> I did write this code years ago, and only can scratch the surface of this,
> but mostly interfacing to boostache has been done via its basic data
> interface: maps and fusion adapted types if I remember correctly.
>
> On the first view boost::mustache looks like a modern replacement for
> boostache. I can understand that some of the interfaces go for boost::json,
> but wonder if boostache went a more lightweight way here with simply having
> a map<string,variant>. Maybe the boost json type is exactly this or
> similar. But maybe mustache can learn from boostache, and take add some its
> interfaces to make transition to a more modern version of a C++ mustache
> library easier for the users.
>

Just wanted to comment on this here, since boostache was a library in a
week invention. The most important innovation in boostache in my view was
the fact that it did not require conversion of a data structure into a
map-like data structure prior to output. The classic Google template (a
mustache engine from years ago) and most others I'd ever seen required this
step. Unfortunately, I didn't have time to look at boost::mustache in
detail, but from my quick look it appears the use of Describe also enables
this direct to format feature.

I'll note that the need for this sort of engine is now much less with
std:format and friends -- which includes range-based output. Json object
output can be trivially and effficiently written with std::format. I'd
also argue that the biggest issue I've had with mustache based output
systems is the lack of format control at the template level. What it leads
to is an explosion of tags for different formats in different types of
templates. If we were to have a templating system I'd like to see it
natively support formatting.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk