[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Experience with Large Applications in Lua?
- From: Ivan Kolev <ikolev@...>
- Date: Wed, 07 Jul 2004 09:50:17 +0300
Indeed, something like the "Option Explicit" (was that the name?) in
Visual Basic would be welcome.
However, I found that with the increasing of the amount of code, one
discovers why most languages have things like type checking or
class/struct declarations.
So I started working on something I call "descriptors" (I don't know
Java, but I've heard it has something similar called reflection). A
descriptor holds all the information about some variable - if it is a
number it can hold the allowed range, for tables it stores the
allowed fields and their descriptors, for functions it stores the
parameter and return value descriptors, etc. Then at some points you can
insert checks for the values against the descriptors, e.g. at each
function call you can check the arguments, and check the return values
after the function ends (some of these things can be done in C, using
the stack).
You can also put documentation in the descriptor, making it easier for
the user of a library to discover its interface.
All the checks of course can be done at run-time only, not at compile
time, so a good unit testing system with coverage would be needed too...
Regards,
Ivan