[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua parser enhancement request
- From: Coda Highland <chighland@...>
- Date: Wed, 29 Jul 2015 13:26:21 -0700
On Wed, Jul 29, 2015 at 1:23 PM, Dibyendu Majumdar
> 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.
> 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
> 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
You could go the opposite direction, you know:
local i --[[:integer]] = 0
Ravi could parse the --[[: prelude and treat it as a type annotation,