Re: [Caja] Functional auditor for Cajita
"Mark S. Miller" <[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Dec 8, 2009 at 2:06 PM, Mike Samuel <[email protected]> wrote: > Is the following copacetic by that definition? > > (function (eval, s) { > eval(s); > }) > > If passed the arguments (freeze(eval), 'a = 0') it will modify the > lexical environment, and I think both arguments are copacetic > according to the frozen functions definition, Aren't we presuming Cajita, in which case this is illegal? If instead full ES5-strict, then the above "eval(s)" code should be considered a special form causing all variables in its lexical scope to be considered accessible and (if assignable) potentially assigned. > > > 2009/12/8 <[email protected]>: >> On Tue, Dec 8, 2009 at 12:05 PM, David-Sarah Hopwood >> <[email protected]> wrote: >>> Note that this implies that the lexical environment of each successfully >>> created instance is observationally immutable, not just that it can't >>> be directly changed by that instance. I.e. it also can't be changed >>> indirectly via an operation on an argument ... >> >> D'oww, I missed that one! Yes, thank you. >> >>> The implementation sketch I gave would preclude that use case because >>> if the supplied argument values are not copacetic, the object's read() >>> method would throw. This might have been too conservative -- if those >>> argument checks were omitted then the property above (that the function >>> instance can't change its lexical environment) would still hold. >> >> Yes. >> >>> It would be possible to make the argument and result checks optional >>> depending on the function annotation: say, /*@pure*/ includes them but >>> /*@functional*/ doesn't. (The environment checks would be the same, >>> and both /*@pure*/ and /*@functional*/ would mark instances as >>> copacetic.) >> >> Yeah I think we're talking about two, possibly both useful classes of >> behavior here. >> >>> What a fun discussion! Thanks for starting it. >> >> Glad to oblige. :) >> >> Ihab >> >> -- >> Ihab A.B. Awad, Palo Alto, CA >> > -- Cheers, --MarkM