lua-users home
lua-l archive

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


Hi,

Ravi allows local declarations and function parameters to have
optional type annotations. This obviously makes any code using such
annotations incompatible with Lua.

It would be nice if Lua had a mode where it ignores any tokens between
a variables name and the comma or equal sign. That is:

local i: integer = 0

In the special mode Lua would ignore everything after 'i' upto the '=' sign.
Similarly:

function (a: integer, b: integer)

Here the text ': integer' would be ignored.

Ravi does not support annotating function return types - but I guess a
similar enhancement would allow optional return type annotation for
functions, but in this case making the parser determine what is to be
ignored is not easy as the syntax of the declaration would need to be
known.

A solution that does not dictate a specific type annotation syntax is
preferable as there is no standard way of defining types; and Ravi's
approach does not always match the approach taken by others.

This enhancement would allow Ravi programs to be run in Lua as Lua programs.

Thanks and Regards

Dibyendu