lua-users home
lua-l archive

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



On 24-Oct-04, at 11:10 PM, Asger Ottar Alstrup wrote:

I agree that an optional type system in Lua would really make a huge difference for us.

We are using Lua today, and are pretty happy with it - except that we mostly work with statically typed programming languages. That means we tend to make a lot of simple keytyping mistakes which are not caught by the Lua interpreter until runtime. We waste a lot of time chasing up such simple typing mistakes, which are normally caught by our compilers in the other programming languages.


I would like to comment on this.

I used to believe that statically typed languages helped 'find bugs' in my code. But then I realized that it was a fallacy to rely on the compiler parse success. It is never 'good enough' to rely on the compiler. Seeing the compiler succeed does not mean that the code is correct.

Sometimes my friends and I have a running joke amongst ourselves... 'It compiled! Quick!... Ship it before it breaks!!!'

If you create a proper test harness for your code, the test harness will test many more things than just 'string' vs 'number' problems.

In my opinion, using test harnesses makes the 'Static typed variables so the compiler can find bugs' point moot.

If you don't have a test harness for your code, how do you know it will work in all the permutations that you expect to use it? If you have a test harness for your code, you don't need the compiler to do static type checking. The only time you really need the compiler to do static type checking is when you don't test your code.

Regards,
Jeff

--
Jeff Koftinoff <jeffk@jdkoftinoff.com>
www.jdkoftinoff.com

Attachment: PGP.sig
Description: This is a digitally signed message part