Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2001-12-21 05:04:46


mfdylan wrote:
> I mentioned this in a message recently, and I actually think this
> idea has quite a lot of potential. Basically what I suggested is a
> method for specifying a message format with positional parameters
> that the compiler can parse. That is, the format specification
> itself constructs some sort of formatting object, that when
> parameters are inserted into it constructs an object holding the
> parameters, that when inserted into a stream unravels itself to
> insert all the parameters and associated "in between" bits of text
> into the stream in the right order.
>
> I suggested something like
>
> (P1 + " found " + P2 + " times in " + P3)
> [snip]

> So the above might produce a
>
> formatter<3, formatter<2, formatter<1, endf> > >
> [snip]
> The tricky part is determining how to reorder the parameters.
> The idea I have is for each parameter insertion to produce a new type
> with an incremented "position" parameter, and then basically you walk
> the resulting typelist, outputting to the stream every time the
> actual position matches the requested position.
> [snip]
> Unfortunately my experience with this sort mega-template-heavy meta-
> programming is all but zero, and I was thwarted in getting very far
> by VC anyway. Anyone think this is a challenge worth taking up?

Frankly, I don't think so.
1. You propose a new method to specify format which won't be familiar to
programmers and translators.
2. That method requires template magic. Is such complexity is needed for the
task of formatting output? What effect on compile time and object size will
it have?
3. I think gettext library keeps the messages in a binary file with some
indices, which allows efficient lookup. That won't be possible with your
approach.

- Volodya
 


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