lua-users home
lua-l archive

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


2013/7/9 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>> > Currently, the problem is even worse, as many people use Lua without
>> > floating-point numbers.
>>
>> I am one of them.
>>
>> For me, 5.3 appears to be a great step forward
>
> Finally, the voice of a silent majority? :)

As far as I'm concerned, it is, regarding the integer addition. And
I'd agree with your rationale ordering (64bits support on general
purpose hardware being more important than limited platforms
optimization). I'm a bit annoyed by the introduction of integers in my
existing code when I don't add a .0 suffix to my constants, but I
guess for my performance requirements some late conversions from
integer to floats won't matter.

But I'd rather keep it a very discreet feature. In other words, not
use it as an argument to import features from other languages that are
better kept in these other languages (in my opinion).

2013/7/9 Roberto Ierusalimschy <roberto@inf.puc-rio.br>:
>> I suppose such data manipulation often requires treating ints as
>> unsigned quantities, therefore a bit64 library would be necessary
>> (in a previous post Roberto said its realization is probable).
>
> We are considering adding bitwise operations to Lua. After all, the main
> reason Lua did not have them was that they were awkward as primitive
> operations over floating-point numbers. With integer numbers, this
> problem is gone.

So far Lua has a syntax quite close to natural language, ie. readable
without knowledge of other programming languages. That's because it's
rather high level, as much as a small implementation can be. With
reasonnable mathematical education, you can understand mathematical
operators (with maybe the exception of ^, though it's a quite common
way to indicate superscript in plain text) and function calls
(assuming you keep your functions functional). With a bit a logical
thinking, the boolean operators behave like the corresponding words in
english (and apart maybe from precedence, I believe they translate
well to many other languages).

But as far as I know bitwise operations have no such ubiquitous
notations (maybe uppercase NOT/AND/OR/XOR?). I think most programmers
would understand C-like bitwise operators. But some users of Lua may
not be familiar with them, and IMHO that would seriously impact the
beauty of the language as it is. People that know C (or a derivative)
can easily interface with some C code, which should do all the heavy
bit mangling.

In other words it feels a little too low level (like the goto
feature), and the overlap with C, which Lua complements so well, may
compromise some of the uniqueness of Lua.