lua-users home
lua-l archive

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


Lua list <lua@bazar2.conectiva.com.br> writes:
>See http://www.lua.org/pil/12.1.html

It would be great if the Lua code in section 12.1 of PIL could be
converted to C and included as a standard library in the main distribution
(either as part of the existing Table library or as a new Serialisation
library).

Another thought... something that occasionally gets discussed on this list
is the possibility of defining a "data-only" subset of Lua. The idea is
that we could use Lua as a general data format without running the risk of
malicious Lua code being executed inside the host program. However, there
has never been any agreement on exactly which subset of Lua should be used.

Since document data formats (notice I didn't say general serialisation
formats!) usually don't need to be cyclic, we could use the output of the
"tables without cycles" serialisation from PIL 12.1.1 as the definition of
Data Lua. The advantage of this definition is that it would have "round
trip fidelity" - if you read such a file into a table and then serialise
that table, you will get exactly the same file back out (apart from
comments, whitespace, etc). This makes the format's behaviour predictable
and reliable. Of course, we would need another standard library routine or
an additional Lua program to verify that a file contained valid Data Lua.
I think this could probably be done on a purely lexical basis and so the
program would not have to be too complicated.

Also, there is a beautiful sentence in PIL 12.1.1:-

"A small aesthetic improvement would be to indent occasional nested tables"

Could be the start of a new book: Interior Design in Lua 5.1...

&.


#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by NetIQ MailMarshal.
The Blackpool Sixth Form College.
#####################################################################################