lua-users home
lua-l archive

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


On Mon, Aug 19, 2013 at 1:02 AM, Tim Hill <drtimhill@gmail.com> wrote:
implicit rather than explicit parameter indexing, which makes
localization much harder (you can't change order in the format string
to match language needs w/o changing the argument order to the call as
well).

Which is why C# uses "strings {1} like {0]" (these can contain extra modifiers).

printf-like flags live on in string.format, but in Lua not such a
problem, since the runtime errors tend to be clearer..  Making up
other 'little languages' like "$(boo) is $(foo)" (or the above C#
style) is an easy exercise of course.  The best we can do is check
these strings early, and fail hard.  This is inconvenient, since we
then cannot have them inline, unless some there's some preprocessor
(and that seems overkill)

Modern C compilers do check (and complain bitterly about) printf flags at least.

C++'s << still seems an elegant solution, but you need to have a feel
for how the overload set of << operates with your types, especially
when adding an overload for a new type.