lua-users home
lua-l archive

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


KHMan <keinhong@gmail.com> writes:
> The direction is not immediately obvious unless you use the calls
> regularly. So in the normal case, people will slow down with such speed
> bumps.

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's very annoying.

I'm very much in favor of "direction-oriented" shift/rotate operators,
even if the implementation actually just looks like:

   function left_shift (val, count) ... end
   function right_shift (val, count) return left_shift (val, -count) end

It would make code using such operators much easier to read.

Even if there's only _one_ such function, its name should reflect what
the shift direction is.

-Miles

-- 
Yo mama's so fat when she gets on an elevator it HAS to go down.