|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-24 07:47:08
----- Original Message -----
From: "mfdylan" <dylan_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, January 24, 2002 1:55 AM
Subject: [boost] Re: Thoughts on Format
> --- In boost_at_y..., Karl Nelson <kenelson_at_e...> wrote:
> >
> > That would not well serve the purpose of allowing
> internationalization.
> > String translation services use printf. It is a large standard
> which
> > we really should obey. This point has been discussed multiple
> > times on the list. Positional simply does not serve the needs of
> > a formating tool.
> >
> > > By the way, Robert's approach doesn't mention about how to write
>
> Surely it's fair to assume most translation services understand the %
> 1 %2 %3 style? It's used by the Win32 FormatMessage API if nothing
> else. As for the problem of how to deal with a number directly after
> the digit, has anyone seriously ever needed more than 9 positional
> parameters in a sentence? And does it really happen so often that
> breaking the string up into two is going to cause a major problem?
> If not, then you just take the first digit after the % and you're
> done. Simplifies parsing, and the pretty rare cases where you might
> want a fixed number directly after a positional parameters aren't
> likely to upset anyone too much. If they do, then make the number a
> parameter too.
Since we don't seem to be using %0 anyway, we could say that (where n,m
represent digits and x a non-digit):
format("%012345") % "hello" => hello2345
format("%12345") % "#1" % "#2" % "#3" % "#4" % "#5" % "#6" % "#7"
% "#8" % "#9" % "#10" % "#11" % "$$" => $$345
format("%2x") % "#1" % "$$" => $$x
This arrangement allows us 99 parameters without introducing %{3} syntax.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk