[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua parser enhancement request
- From: Coda Highland <chighland@...>
- Date: Wed, 29 Jul 2015 14:17:57 -0700
On Wed, Jul 29, 2015 at 2:08 PM, Dibyendu Majumdar
<mobile@majumdar.org.uk> wrote:
> On 29 July 2015 at 21:26, Coda Highland <chighland@gmail.com> wrote:
>> You could go the opposite direction, you know:
>>
>> local i --[[:integer]] = 0
>>
>> Ravi could parse the --[[: prelude and treat it as a type annotation,
>> while Lua will simply ignore it. This is what some typed Javascript
>> tools do.
>>
>
> Sure, but I am keen to keep the syntax clean for Ravi.
>
> Regards
>
It's not that bad, and you could also use:
local i = 0 -- @integer
or
-- @integer
local i = 0
et cetera. Adding semantically-important annotations/directives in
comments has a lot of precedent:
Python proposal - https://www.python.org/dev/peps/pep-0484/#type-comments
Real-world Javascript -
https://developers.google.com/closure/compiler/docs/js-for-compiler?hl=en
Java analysis tool -
http://types.cs.washington.edu/checker-framework/current/checker-framework-manual.html#annotations-in-comments
Turbo Pascal - don't have a link but it has significant comments for
preprocessor directives
Go language - https://golang.org/cmd/gc/#hdr-Compiler_Directives
/s/ Adam