…whatever you want to call it.

This weekend I have been mostly playing with Lua 5.1work2 (a prerelease of Lua 5.1) and I have been enjoying trying my hand at a deep and scary change. I have added documentation strings both to the internals of the language and to the language itself. I wanted introspectable documentation a-la python docstrings; so I added the following production…

docstring ::= <b>'-=-'</b> CHARS <b>'-=-'</b>
file ::= [docstring] chunk

…and then changed the following production to be…

funcbody ::= <b>'('</b> parlist <b>')'</b> [docstring] block <b>end</b>
tableconstructor ::= <b>'{'</b> [docstring] [fieldlist] <b>'}'</b>

(See The Lua Manual for the original productions)

Which allowed me to have docstrings delimited by the dash,equals,dash sequence at the start of files, functions and tables. Since my class system uses a table to build the class body; this allows me to document classes too. Internally to the language, userdata objects can also have documentation attached to them; allowing the C-side to attach documentation without having to have lua wrappers all over the place.

This change proved to be really quite invasive; but I guess I’m happy with it for now. Just waiting on the Lua team to decide whether or not they want an official GNU Arch archive before I go dumping this lot into arch to begin serious work on Aranha at last.

Comments on this page are closed.