lua-users home
lua-l archive

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



On Aug 1, 2015, at 12:23 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:


Oh, the verbosity can be cured, by borrowing an idea from
Fortran. (To go with origin-1 indexing, the arithmetic "for", etc.)

Give Ravi a function IMPLICIT (capitals, please! like C preprocessor
directives).

IMPLICIT ("integer", "[^I-N]")

If a name matches the pattern, values assigned to it must be
of the indicated type. Ravi would of course not treat IMPLICIT
as a function but as a compiler directive. It's a function to
allow Lua to do nothing.

To make Ravi programs compile under Lua, one can do this:

lua -e "IMPLICIT=load''" xxx.ravi

I actually liked the old Fortran model, and am sill ok with languages that use sigils for the same purpose (though Lua dropped them long ago). While making code look a bit more geeky they do have the huge advantage of clearly showing the type of the variable at its point of use as well as point of declaration (how many times have we had to hunt through #include files to find a hidden declaration?).

—Tim