Re: Fusion Laws?
Boris Zbarsky <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
On 3/30/16 6:17 PM, Michael Haufe wrote:
> In general yes. The exceptions are of course idempotent ones like dom calls which are constant after creation (window.self perhaps?), and innocuous side-effects that are never used:
>
> xs.map(function(x){
> var d = Date.now(); //side-effect
> var r = Math.random(); //side-effect
> return x
> });
The problem is that it's hard to prove functions are side-effect-free in
JS, in even this weak sense. For example, your function there might do
absolutely anything, depending on what's been done to the Date and Math
properties on the global. :(
-Boris