[whatwg] Side effects free scripts
news at terrainformatica.com
Wed May 31 15:43:42 PDT 2006
----- Original Message -----
From: "liorean" <liorean at gmail.com>
To: "whatwg" <whatwg at whatwg.org>
Sent: Wednesday, May 31, 2006 9:54 AM
Subject: Re: [whatwg] Side effects free scripts
| On 31/05/06, Andrew Fedoniouk <news at terrainformatica.com> wrote:
| > ----- Original Message -----
| > From: "liorean" <liorean at gmail.com>
| > From mathematic standpoint:
| > By its definition Math.random() function is not side effect free
| > in ECMAScript. It uses static variable for generation of pseudo-number
| > sequences.
| Well, the ECMAScript spec states:
| >188.8.131.52 random ( )
| >Returns a number value with positive sign, greater than or equal to 0
| but less than 1, chosen randomly or pseudo randomly with approximately
| uniform distribution over that range, using an
| implementation-dependent algorithm or strategy. This function takes no
| There is nothing in that definition that I find indicates that it has
| any side effects. It's all about generating a number, no side effects
| are specified or implied.
This does not mean that it has no side effects.
I don't know any algorithm of random number generation which is not
using previous value stored somewhere (seed). (I mean software based
random generation only)
Pseudo number generators have long but limited length of generated sequence.
So in some circumstances external "no side effects script", being invoked,
can force legacy code to produce not so random data. I think you understand
implications of this.
David, this is just one small demo of the problem.
Formally: as there is no formal detection algorithm
as term "side effect free script" is a nonsence, mathematicaly speaking.
More information about the whatwg