[erlang-questions] On OTP rand module difference between OTP 19 and OTP 20

Richard A. O'Keefe ok@REDACTED
Fri Sep 1 03:11:29 CEST 2017


Sometimes people program against the documentation.
Sometimes people program against the behaviour.
Sometimes people program against their expectations
and the hell with the docs and the code.

In fact you are never going to please everyone.
My case study:
   The Quintus Prolog documentation had always said
   "do not add or remove clauses of an interpreted
    predicate while it is running; the behaviour is
    not defined."
    In major release 3, as part of implementing modules,
    we defined the behaviour to be "every call acts as if
    it made a snapshot of the predicate on entry and used
    that snapshot; changes to the predicate will affect
    later calls but not earlier ones".
    One customer complained that we had broken his code.
    We not only pointed out that the manual had warned
    against what he was doing, I rewrote his code to
    run 700 times faster.  (I kid you not.)

Of course we lost that customer.

I wish there was a blanket rule I could recommend.
There is one, of course, and that is "test before you
release".  In this particular case, it's quite hard
to test because the bad outcome is extremely rare.
(Although I do have a photocopy of the library of an
old programming language where the Gaussian random
number generator could not possibly have worked,
because 0 turned up once every 2^16 calls.)

There is another rule, which is that changes to the
documentation and changes to the code both need to
be clearly communicated in release nodes, and as a
user, it's my job to *read* the release notes.

The irony here, of course, is that Erlang copied as183
from Prolog, and I wrote the Prolog version of the
Wichmann-Hill 3-cycle generator, and it doesn't take
any care to avoid 0.0, and that's one reason why I was
glad to see it replaced...



More information about the erlang-questions mailing list