[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: What's up with token filters (Re: New operators?)
- From: David Given <dg@...>
- Date: Sun, 15 Apr 2007 21:44:34 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Asko Kauppi wrote:
[...]
> I.e. replacing a number of a= a..b with table.concat() is way outside of the
> optimization scope, right?
Oddly enough, that's exactly what Java does. If you say:
String s = s1 + s2 + s3 + "foo";
...then (assuming s1, s2, s3 are strings) what you usually *get* is along the
lines of:
String s = new
StringBuilder().append(s1).append(s2).append(s3).append("foo").toString();
So, provided the Lua compiler can prove that all the parameters are actually
strings (and that the string metatable hasn't been extended or table.concat()
has been modified) then yes, this is a perfectly valid optimisation.
- --
┌── dg@cowlark.com ─── http://www.cowlark.com ───────────────────
│ "Parents let children ride bicycles on the street. But parents do not
│ allow children to hear vulgar words. Therefore we can deduce that cursing
│ is more dangerous than being hit by a car." --- Scott Adams
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGIo6yf9E0noFvlzgRAsFEAKCMRc5fj9r+FTwivINWERzQuU7qXwCdFE8Q
HJC8WEHuvq/L7vkGqjtJHbI=
=B2QN
-----END PGP SIGNATURE-----
- References:
- Re: What's up with token filters (Re: New operators?), Robert Raschke
- Re: What's up with token filters (Re: New operators?), Roberto Ierusalimschy
- Re: What's up with token filters (Re: New operators?), Asko Kauppi
- Re: What's up with token filters (Re: New operators?), Luiz Henrique de Figueiredo
- Re: What's up with token filters (Re: New operators?), Fabien
- Re: What's up with token filters (Re: New operators?), Luiz Henrique de Figueiredo
- Re: What's up with token filters (Re: New operators?), Fabien
- Re: What's up with token filters (Re: New operators?), David Given
- Re: What's up with token filters (Re: New operators?), Rici Lake
- Re: What's up with token filters (Re: New operators?), Thomas Lauer
- Re: What's up with token filters (Re: New operators?), Fabien
- Re: What's up with token filters (Re: New operators?), Asko Kauppi