lua-users home
lua-l archive

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


On 12/7/2010 7:30 PM, Roberto Ierusalimschy wrote:
Yup ... the bit-shifting functions in Emacs-lisp are of the "only one
function with the shift-count sign determining direction" variety, and I
have to check the documentation _every_ time I use them, or when I read
code using them, to see what the "main" direction is -- even though I've
using them (occasionally) for probably decades...

It shifts to the left for positive countings, does it not? It is not
dificult to figure out, although I have never used Emacs-lisp. If you
remember that shifting is basically a multiplication by a power of 2,
it becomes quite intuitive that 1 shifts to the left and -1 shifts to
the right.

I'm sure it may sound okay in theory, like so many things. Lisp is great with their culture, like keeping the assembly language mnemonics CAR and CDR like a couple of sacred cows.

Given half-a-dozen shifts and rotates in both directions in a listing, one will start looking at the adding and subtracting and mentally look that up, like an extra level of indirection. This adds... this subtracts... now which way does this one go...

On second thoughts, it is a great idea. It would be very disappointing if we don't implement it for the beta release.

...

...

[Yes, just trying to be cute. Bungling attempts at comedy...]

[This is similar to the paranoia some of us have with setting tri-state configurations. For some MCUs it's a 1, for others, it's a 0. In theory, the specs are all crystal clear. In practice, something inexorably gnaws at the mind each time we look at that line of code...]

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia