[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: detecting undefined variables--a new mixed approach
- From: Thomas Lauer <thomas.lauer@...>
- Date: Thu, 27 Mar 2008 12:59:57 +0000
David Manura <dm.lua@math2.org> wrote:
> I haven't been entirely satisfied with the existing approaches to detecting
> undefined variables, as typified by etc/strict.lua (run-time) and
> test/globals.lua (static analysis).
+1.
However, I've now spent a good while with trying to get to grips with
this problem and I have come to the conclusion that Lua is too dynamic
for a fully static solution (at least if I want to keep the complexity
of the solution within reasonable limits).
> So, can anyone tell me why this not better than the other approaches?
Well, I played around with your patch and while the approach is
perfectly feasible, the granularity (one check per function) makes using
it difficult. I just can't see me calling checkglobals() for all
functions that might or might not use undefined variables. I'd much
prefer a fully automatic approach along the lines of strict.lua or my
strict module.
I have used the latter for about a year now and it works quite well,
although I agree that all such solutions require either some sort of
code coverage tool or *extensive* testing.
Let's keep on tryin':-/
--
cheers thomasl
web: http://thomaslauer.com/start