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 13:29:15 +0700
Message-ID: <op.taauy1yz1h6og4@localhost>
On Mon, 29 May 2006 13:13:30 +0700, Andrew Fedoniouk <news at terrainformatica.com> wrote:

>> 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.

> Strictly speaking returned result changes state of the world.

It's not the script itself which does it. The caller could use the return value to change the state of the world according to it, but the caller isn't "side effects free".

> And in practice something like:
> function foo() {  return "bar" + foo();  }
> will definitely change state of the system.

No, it won't. It will hit either the stack depth limit or the time execution limit, but the state of the world won't change in either case.

> Because of "halting problem" the only feasible way to ensure safety of the
> function (at some extent) is a sandbox.

Sandboxes don't prevent scripts from hanging, either. It's the execution time limit which helps deal with such cases.


-- 
Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com
Received on Sunday, 28 May 2006 23:29:15 UTC

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