W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2006

[whatwg] Side effects free scripts

From: Alexey Feldgendler <alexey@feldgendler.ru>
Date: Mon, 29 May 2006 12:47:57 +0700
Message-ID: <op.taas17am1h6og4@localhost>
On Mon, 29 May 2006 08:31:06 +0700, Andrew Fedoniouk <news at terrainformatica.com> wrote:

>>> Ok, here you make it clear that with side effects you only mean visible
>>> side effects?

>> No, all side effects in the mathematical sense. The script is not allowed
>> to alter the state of the world in any way.

>   Code which is not altering the state of the world cannot produce anything
>   useful (work) for that world.

The only useful result of a side effects free script is its return value. That is, in fact, the very purpose for which CSS expression() exists. It's MEANT to be side effects free, but is systematically abused.

By the way, there are even some optimizations for expression() handling possible when the scripts are forced to have no side effects -- it's possible to avoid repeated invocations of the script when it's known that the state of the world has not changed.

Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com
Received on Sunday, 28 May 2006 22:47:57 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:46 UTC