lua-users home
lua-l archive

Re: printf is a crappy language in a crappy language (was Re: [OT] Lua community and Go language)

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Aug 19, 2013 at 9:37 AM, Coda Highland <chighland@gmail.com> wrote:
> C++'s << is nice, but doesn't address reordering parameters for localization.
<c++>
printF(cout,L("Hello {0}, ({1})\n"),Strings() << name << age);
(exercise for the reader. Strings is a type with a templated <<
operator which uses ostream<< to make up a list of appropriate
strings, printF then should be pretty easy. L() just matches a string
in a suitable localization file)
Or even (with implicit L() and a suitable wrapper type PrintF)
PrintF(cout, "Hello {0}, ({1})\n") << name << age;
</c++>

AltStyle によって変換されたページ (->オリジナル) /