lua-users home
lua-l archive

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


On Wednesday 20 April 2005 7:16 am, Gavin Wraith wrote:
> If the final string is actually needed, that is clearly the way to go.
> In practice, it very rarely is needed. Usually the rope/stringle (sorry
> "stringle" was an extemporization) gets written out to a file. The point
> is that ropes are very easy to program in Lua. I doubt whether managing
> them at the C level gains one very much.

the biggest gain would be because of transparency.  having a good enough 
implementation inside the language would eliminate in a single stroke most of 
the bad usages of strings.

it's just like the desition of using hash tables as the only structure, and 
like using hashed strings; good algorithms in the core mean better code 
overall.

an example where it would be nice (but not essential) is in Xavante:  a 
handler can generate HTTP response content in three ways:

1) setting res.content to a string
2) setting res.content to an array of strings
3) calling httpd.send_res_data()

for small responses, option 1) is the easier; for bigger things it's nice to 
use 2); and for huge, complex things 3) is the only way left.  losing some 
nice things, like being able to set headers at any time (because the content 
is sent at the end), and letting Xavante to handle the "Content-Length" 
header needed to use persistent connections (with big performance gains)

with a scalable string implementation, usage 2) would be useless, so the 
choice would be easier.  also, XML results would be easy to generate 
efficiently, that would make it worthwhile to put the 'X' in SAJAX to good 
use!

-- 
Javier

Attachment: pgp5JuxYwwDPY.pgp
Description: PGP signature