[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: patch: C-style string lexing
- From: "Eric Tetz" <erictetz@...>
- Date: Thu, 31 Jan 2008 11:02:04 -0800
On Jan 31, 2008 8:24 AM, Mark Hamburg <firstname.lastname@example.org> wrote:
> I agree that the better answer here is constant folding for
> string concatenation.
Well, that's the more *viable* answer. It would be *better* if
it could be done during lexing, but as we've seen, that's not
> But I don't see it as a huge burden to have to write:
> myBigString = "The first part of the string "
> .. "is followed by the the second "
> .. "part of the string."
It's certainly no burden to *type*, but I think most programmers
find it unappealing to incur a performance penalty for the sake
of source beautification. If you've got 50 lines, Lua's creating
48 strings of intermediate garbage just to concatenate them,
The obvious alternative is to use long strings, but you can run
into issues where you need more control over what goes in that
string (e.g. http://lua-users.org/lists/lua-l/2008-01/msg00361.html).
I only brought up C-style lexing because it's so trivial to add
and is syntactically simple. It just has the small problem of
breaking Lua. ;)