[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] lglob (was: Convenient undefined variable checking script)
- From: Kevin Clancy <kclanc@...>
- Date: Thu, 31 Jan 2013 11:31:36 -0600
Up until recently, I had been working on something very similar to what
you have just described, using F# as the implementation language. It's a
static analysis tool which supports OOP-style programming and
prioritizes freedom over type safety. Despite this prioritization, it
can also catch many of the types of errors that you are interested in.
It's still a little rough around the edges, but it seems usable. (I have
had limited time to test it, being an undergrad.) The bitbucket repo for
the project is located here: https://bitbucket.org/kevinclancy/love-studio.
My approach to OOP programming was to use a plugin architecture; plugins
written for my static analysis tool are given (roughly) two tasks. One
task is to translate the annotated lua AST of a module into a type
(represented using an F# discriminated union instance) which that module
defines. The other is to decorate a module's AST with additional type
information in preparation for typechecking; for example, a plugin might
decorate a module's "self" formals with the private type defined by that
I'm still trying to decide if this project was a Berezina or not. Given
the interest surrounding this topic, however, I thought it might be
worth pointing out that such things have been attempted.
On 1/31/2013 1:07 AM, steve donovan wrote:
On Wed, Jan 30, 2013 at 10:16 PM, Petite Abeille
Yes, this is all for 5.2. And yes, _ENV is special in 5.2 :)
Very special! In fact, I am going to ignore it for a while, except
perhaps as an idiom for creating modules. I'm not seeing much use of
it in the wild, so the focus is on 'modern' Lua which is the 5.1/5.2
Your first TestGlobal.lua is now working consistently, due to improved
handling of SETTABUP.
The Berezina  of Computer Science: Static Analysis Of Dynamic Languages
Hah, indeed! Since I have no imperialistic urges, I'll concentrate on
reliability. I had this bright idea to analyze Lua OOP-style code by
making 'self' a reference alias to the owning table, but it would only
work under certain conditions. There are too many ways to peel that
avocado in Lua...