lua-users home
lua-l archive

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

On Mon, Mar 31, 2014 at 9:13 AM, Tim Hill <> wrote:
> Agreed. If it were me I'd prefer an editor/analyzer/compiler solution to one involving run-time overhead (though, of course, in many cases "compile time" is part of "run time" for many Lua scripts, but you know what I mean).

I do think that Peter's approach of actual source analysis is going to
be the winner eventually, because there's only so much you can do with
the bytecode itself without context.

However, I was pleasantly surprised at how far you can get.  lglob
does (optionally) some dynamic things - it will pull in requires so it
can check the names of imported modules, and tracks aliases to
modules. E.g. this will be flagged as an error, since 'cwd' is not in
'lfs'.  Likewise 'math.sine' and so forth.

local lfs = require 'lfs'

The point of this digression:  run-time checking can be generalized as
well, so that 'math.sine' is an error. This is why pl.strict
generalizes the 'strict.lua' pattern so that modules may be strict as