[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (work1) now available
- From: Ico <lua@...>
- Date: Tue, 09 Jul 2013 20:23:56 +0200
* On Tue Jul 09 20:02:48 +0200 2013, Jerome Vuarand wrote:
> > 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.
>
> 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.
It probably very much depends on the type of application and programmer.
People who regularly use bit operation probably do so in a language
where native operators are available (i.e. C), and chances are they are
familiar with the various idioms, for example
val = val & ~mask
for clearing bits in a word. Doing this with bit32 does not result in
code that is more readable, IMHO:
val = bit32.band(val, bit32.bnot(mask))
For a user not familiar with bit operations both probably look as
confusing, but the first at least feels more natural to those who *are*
regularly using binary operators in other languages.
As for me: I'm using Lua a lot for pretty low level embedded targets,
and having bitops would make my code cleaner and my life a bit easier.
--
:wq
^X^Cy^K^X^C^C^C^C
- References:
- Re: [ANN] Lua 5.3.0 (work1) now available, Miles Bader
- Re: [ANN] Lua 5.3.0 (work1) now available, Luiz Henrique de Figueiredo
- Re: [ANN] Lua 5.3.0 (work1) now available, Enrico Colombini
- Re: [ANN] Lua 5.3.0 (work1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work1) now available, Lorenzo Donati
- Re: [ANN] Lua 5.3.0 (work1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work1) now available, Lorenzo Donati
- Re: [ANN] Lua 5.3.0 (work1) now available, Joseph Manning
- Re: [ANN] Lua 5.3.0 (work1) now available, Todd Coram
- Re: [ANN] Lua 5.3.0 (work1) now available, Lorenzo Donati
- Re: [ANN] Lua 5.3.0 (work1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.3.0 (work1) now available, Jerome Vuarand