lua-users home
lua-l archive

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


> Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
> > - The definition of a numeral in Lua follows C (which, in retrospect,
> > may not have been a very good idea). So, things like "3." are correct,
> > too.
> 
> In which cases is it not a good idea...?

- It creates silly conflicts, such as x = 3..7

- It complicates the lexer

- It complicates any informal or formal description of numerals

- It complicates patterns that have to match numerals

Also, one can argue whether writing 3. is any better than 3.0. (It saves
typing one character, but it is an easy one to type.)

Maybe a simpler definition, demanding at least one digit before and after
the dot, would be more "Lua-like".

-- Roberto