lua-users home
lua-l archive

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


Grey Knight <tinyplasticgreyknight@yahoo.com> wrote:

> On Monday, January 29, 2018, 8:23:53 AM GMT, steve donovan <steve.j.donovan@gmail.com> wrote:
>> some standard for type annotation
>> 
> I think this is the only thing I really want as a syntax addition. 

Actually, adding an optional type system to Lua was considerably easier than
I thought it would be. Just needed to add an extra field in the lua_TValue
struct to hold the expected type, then check the current type against the
expected type for any instructions that set R(A) and throw an error if they
do not match. Of course, if there is no expected type then no check is done.

I also added a field to indicate the class 'isa' type for objects, along
with an extra field for class typecasts (for super calls and typecasting). 

~Paige