phobos / tango / ares
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Sat Feb 10 07:11:15 PST 2007
Bill Baxter wrote:
> Is there any reason not to make the format item's index also optional?
> So that
> Formatter("{} {} {}", a, b, c);
> can be used? I mean making it more like %s?
>
> The meaning would just be "use the index (1+ the last one that
> appeared)" or 0 if it's the first to appear.
>
> And then if you go there, it might be nice to have a way to say "same as
> the last item" or "last item +/- some index". Maybe use +/- numbers. So
> Formatter("{1} {+0} {-1}",a,b);
> would be equal to
> Formatter("{1} {1} {0}",a,b);
> I can't really think of when I'd use that though. The {} I'd use for
> sure though.
>
> Anyway, the positional references are great, and really a must have for
> any serious I18N usage, but in the original language the app is written
> in, things tend to appear in the order of the arguments.
An argument against that would be: Don't you think it'd be easier on the
translators if they could just pick the argument number out of the
untranslated string without having to keep a running count of which
argument they're at?
I'd very much like the "{} {} {}" syntax though, especially for anything
quick-and-dirty.
The "relative" argument numbers I don't see much use for either.
More information about the Digitalmars-d-learn
mailing list