lua-users home
lua-l archive

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



On Mar 26, 2014, at 2:02 AM, Lorenzo Donati <lorenzodonatibz@tiscali.it> wrote:

Yep, that was, more or less, the use case I had in mind.

also @steve:

with the introduction of bitwise ops and 64bit integers Lua becomes more
attractive for bit fiddling. Packing binariy numbers in hex is useful
IMHO only when the individual bits have no specific meaning.

When you come to representing status registers of devices, complex
protocols and so on, being able to express them explicitly enhances
readability and documentation.

As you point out, you can exploit Lua syntax and function calls for that
(and also for the digit separator I proposed), but having that
feature at parsing or lexing level probably adds very few C lines to Lua
code and allows using that feature with less fuss in embedded devices or
in computationally-constrained contexts.

Of course YMMV.

Cheers.

-- Lorenzo

I agree with this. Any argument against binary representation has equal validity against hex representation, yet Lua has those. Both hex and binary provide alternate source representations that can, when used judiciously, assist in code readability, which is really the only reason they exist. Technically there is no reason why Lua needs either.

—Tim