[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: More on environments and objects
- From: Adrian Sietsma <adrian_groups@...>
- Date: Sun, 28 Aug 2005 02:27:26 +1000
Rici Lake wrote:
I use bit operations for fairly long bit strings. Using bits in a number
in order to compress a small number of "flags" into a single operation
strikes me as an abuse both of flags and numbers, but that might be just
me being a purist.
my major "number as bitset of flags" use is returning status codes from a
function in c. since lua funcs can return mutiple values, and/or an ad-hoc
table, it's not a normal usage case.
i would personally use a mutable buffer for the string of digits - give it a
string constructor, __tostring() retriever, and have it return 0 for any
out-of-range bits. it can auto-expand on bit set if required.
(i'm biased - i have such a buffer class)