lua-users home
lua-l archive

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



>> [in hex notation] every character takes
>> exactly the same number of bytes,

>Variable v.s. fixed length is not inherent in hex or decimal form.  A
>language could support "\x1\x12\x123" (variable length hex) and
>"\001\012\123" (fixed length decimal).  Fixed length decimal does
>leave some values undefined though:

True. I meant to say that it is considered perfectly natural to write hex 
numbers (of a particular bit length) so they all take the same number of 
bytes -- leading zeros can be considered normal when you write in hex, 
since each digit is exactly four bits, but exceptional when using decimal, 
since we are conditioned not to use them day-to-day (except for decimal 
fractions less than 1 or, of course, zero itself :-).

Which means that when, oops, if :-) the Lua authors implement hex escapes,
I would be in support of the fixed length, one-byte format, like this:

\x00
\x01
. . .
\xfe
\xff

So a CR LF line ending would be \x0d\x0a and never \xa\xd.

However, my initial zest to see this feature implemented has evaporated. 
After all, as LHF suggested but I originally refuted, it *is* bloat (being 
unnecessary since there already exists a way of embedding arbitrary bytes 
in strings), no matter that it is small bloat. And as someone else pointed 
out, lots of small bloats make a big bloat :-)

Plus I just took into account that despite all my years doing low-level 
stuff on PCs, I can still count (and add, and definitely multiply) in my 
head far better in decimal than any other base...

So my vote on this suggestion is now definite: I'll sit on the fence :-)