lua-users home
lua-l archive

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


2014-03-25 20:50 GMT+02:00 Coda Highland <chighland@gmail.com>:

> There's a de-facto standard in place now

>From Bouvier's Law Dictionary, Revised 6th Ed (1856) [bouvier]:

  FACTO. In fact, in contradistinction to the lawfulness of the thing; it is
  applied to anything actually done.

> Java, C#, Javascript, Python, and PHP all agree that right shifts
> are arithmetic shifts.

Thanks for this nearly complete list (Perl is missing) of languages
that I love to hate. Why is Perl missing? Because you did not look
it up or because it fails to fit the bill?

> Having Lua disagree in this respect violates the principle of least surprise.

The principle of least surprise, IMHO, demands that the idiom
x << m >> (64-n) should give a non-negative number less than 2^n,
consisting of the n bits starting at the (m+1)-st th bit from the left,
irrespective of whether that bit is a 0 or a 1.