lua-users home
lua-l archive

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

I'm sorry to say but you'll be disappointed. Lua currently has few keywords, and there is great hesitation before adding a useful one. See the recent multidozen reply continue thread for an example. To add a keyword that does nothing, and will (almost definitely) never do anything, would be very counter-lua.

So why not just use metalua? You could easily add a keyword which acts as a single line comment in that. Or if you prefer regular Lua, why not just use a comment? Your editor might even allow colouring --typedecl differently to regular comments, with enough tweaking.

- Alex

----- Original Message ----- From: "Norman Ramsey" <>
To: <>
Sent: Wednesday, February 27, 2008 4:05 AM
Subject: another hat in the ring regarding Lua 5.2: static typing

I dream of one day being able to do static type inference
on my Lua programs, thereby catching innumerable silly errors.
I worked on this problem one summer with Inna Zakharevich, and
it's not clear that we will ever get anywhere, but I would
dearly love it if Lua 5.2 contained some syntactic hooks
that could be used to write down type definitions and
to write down the types of some variables.  Since we have
no idea what we want, I'd simply ask for a syntax

 typedecl string-literal

which the current compiler would ignore.

I realize the same effect could be achieved at present by simple

 function typedecl() end

but (a) that would have a small run-time cost and (b) I'm really
asking the Lua team to pick a keyword and reserve it for future use.