lua-users home
lua-l archive

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


On Wed, Jul 07, 2004 at 10:50:21AM +0200, Steve Donovan wrote:
> In a nutshell: we need strong testing, not strong typing.

The problem I have with this argument is that a static type checker:
a) is more reliable
b) will tell you exactly where the problem is, rather than throwing up
an error at some point later when you try and misuse a value.

Test are all well and good, but it can still require some time spent
with a debugger to actually identify where the badly typed value is
being introduced, unless:

> But surely standard Lua tricks could be used to enforce this kind
> of more precise run-time typing?

Certainly, but once you've filled your program with type annotations
in order to ensure that type errors are caught quickly, you've lost a
good chunk of the advantages of dynamic typing.

In this vein though, it would still be nice if one could write in Lua
something like:

function foobar(String x, MyClass y) ... end

Where String and MyClass are predicates aginst which the arguments can
be checked, if enabled by an interpreter flag.

-- Jamie Webb