lua-users home
lua-l archive

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


Vaughan McAlley wrote:
On 7 December 2010 05:16, Ralph Hempel <rhempel@bmts.com> wrote:

It seems to me that really only three operators needed, and the
implied direction of the shift value should be consistent across
all three, like this:

ashift - arithmetic shift (+right -left )
rotate - rotate           (+right -left)
lshift - logical shift    (+right -left)

I seem to recall that idea being proposed by the devs and it going
down very badly. Luckily with Lua it’s trivial to alias arshift as
ashift.

On an embedded system, I would like to have as few functions as
possible, they should be orthogonal, and I don't want to modify
the stock code so that my pbLua works just like the one in the
manual.

With those three base operators, if you really need the shift to
go in the opposite direction, write an alias for that :-)

It's too bad that something as "simple" as a bit library gets this much attention :-)

I think the devs suspected the bit library would be this
controversial, and probably spent a while steeling themselves before
getting to work :-)

Part of that is the whole bikeshed problem. A bit library really should
be a simple thing, and everyone has their opinion on how they would like
it to work - including me.

I fully respect the language author's decision to do it whichever way
they choose. I was just pointing out the inconsistency in the shift
operators in case they had been staring at it so long that it was not
obvious to them :-)

Cheers, Ralph