lua-users home
lua-l archive

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


Gavin Wraith wrote:
...
One might also argue that by keeping them different the programmer can
choose which one he wants. Mathematicians want remainders that are
always positive, whatever the sign of the arguments. The fact that
programming language implementers have been getting it wrong for
nearly half a century is not a good argument for sticking with the
status quo. Haskell provides both alternatives, so Lua would be in
respectable company if it too decided to keep both.

But remember that, if you choose '%' you are also choosing the higher performance path, so you have two unseparable variables in your choice. And it seems that compatibility with C, C++, Java, Javascript, Python and Perl is a pretty compelling argument for having it behave like math.mod()!

--
chris marrin                ,""$,
chris@marrin.com          b`    $                             ,,.
                        mP     b'                            , 1$'
        ,.`           ,b`    ,`                              :$$'
     ,|`             mP    ,`                                       ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'