lua-users home
lua-l archive

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


>> for example, you can have harsh (but simple) requirements such as
>> "the code must not contain any looping constructs" or even "the code
must
>> not contain any control constructs". Such requirements are easy to check
>> statically thanks to the simple and uniform structure of Scheme code.

> You forgot about recursive loops. Will you put "the code must not
> contain any calls" in your requirements? I guess you need them for
> "cons", "list", etc. You also need some kind of assignment, if you want
> to send cyclic data. If you allow calls and assignment, then to check
> for recursive calls is not that trivial ;-)

For the purposes of wire transmission, one could probably use a highly
restricted subset of either language
(Scheme or Lua). In Lua, a reasonably complete marshaller can be written
making use only of assignment
statements, which suggests that they could be executed using a crippled
version of the VM (missing,
for example, looping constructs) or by a crippled parser. Were library
functions necessary, a very
limited collection could be provided in a custom global environment.

For most purposes, however, such complexity is not required. While it would
slow things down a little,
it is easy enough to write a custom parser (in Lua) for a simple
demarshaller. Although this might not
be quite as fast as using the built-in Lua parser, it is still quite fast;
moreover, it can significantly reduce
wire traffic (something which XML-RPC and SOAP don't seem to care about at
all but which I do, I'm
afraid -- bandwidth is still a limited resource where I work.)

I have to say, though, that IMHO ASN.1 is better. Unfortunately, it suffers
from a lack of freeware tools,
but creating them would be an excellent project for the infamous somebody :
-)

Rici.