lua-users home
lua-l archive

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

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:

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 module.

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
<>  wrote:
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 [2] 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...

steve d.