lua-users home
lua-l archive

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


On Mon, Mar 31, 2014 at 7:32 PM, Andrew Starks <andrew.starks@trms.com> wrote:
> That said, I now suspect that, in a dynamic language, analysis might
> be a better approach. It's free, in that it doesn't need to go along
> with your deliverable and checking for something always costs.

Well, static analysis isn't perfect ;)

e.g. this is what I get from Penlight, with *** comments:

C:\dev\lua\Penlight\lua\pl>lglob *.lua
-- file app.lua
-- file array2d.lua
-- file class.lua
*** misfire! *****
lglob: class.lua:235: redefining global rawget.__index
lglob: class.lua:245: redefining global rawset.__newindex
-- file compat.lua
**** fair enough, this is Lua 5.1... ***
lglob: compat.lua:86: undefined get debug.upvaluejoin
**** Helpful indication of slightly dodgy behaviour! ***
lglob: compat.lua:114: redefining global table.pack
lglob: compat.lua:127: redefining global package.searchpath
-- file comprehension.lua
-- file config.lua
-- file data.lua
-- file Date.lua
*** which was the embarrassing typo ***
lglob: Date.lua:236: undefined get old_dist
-- file dir.lua
-- file file.lua
-- file func.lua
-- file import_into.lua
-- file init.lua
-- file input.lua
-- file lapp.lua
lglob: lapp.lua:217: undefined get lapp.slack
-- file lexer.lua
-- file List.lua
*** misfire! ***
lglob: List.lua:36: undefined get List.List
-- file luabalanced.lua
-- file Map.lua
-- file MultiMap.lua
*** misfire! ***
lglob: MultiMap.lua:19: undefined get MultiMap.MultiMap
-- file operator.lua
-- file OrderedMap.lua
-- file path.lua
-- file permute.lua
-- file pretty.lua
-- file seq.lua
-- file Set.lua
-- file sip.lua
-- file strict.lua
-- file stringio.lua
-- file stringx.lua
-- file tablex.lua
-- file template.lua
-- file test.lua
lglob: test.lua:15: undefined get utils.pack
-- file text.lua
-- file types.lua
-- file utils.lua
*** because these are initialized with the utils table (line 13) ***
lglob: utils.lua:234: undefined get utils.dir_separator
lglob: utils.lua:240: undefined get utils.execute
lglob: utils.lua:293: undefined get utils.load
-- file xml.lua
lglob: xml.lua:682: undefined get _M.debug
lglob: xml.lua:689: undefined get _M.debug

So I'm thinking what's needed is a lglob.cfg file which works like the
ldoc config file; if lglob finds it, uses the flags and there's an
'ignore' table where we put things we don't regard as a problem.  Then
running lglob will only give _new_ problems.

That being said, always room for improvement!  It's certainly good
enough to eliminate a whole class of problems without actually
launching the application.

steve d.