[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua parser enhancement request
- From: Nagaev Boris <bnagaev@...>
- Date: Wed, 29 Jul 2015 23:27:58 +0300
On Wed, Jul 29, 2015 at 11:23 PM, Dibyendu Majumdar
<mobile@majumdar.org.uk> wrote:
> 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
>
I think, better solution would be to write Ravi-to-Lua converter,
which can operate as Lua interpreter, converting code on the fly.
--
Best regards,
Boris Nagaev