David-Sarah Hopwood wrote: > [Cross-posted to e-lang from google-caja-discuss. I suggest continuing on > e-lang, since there's not much that is Caja-specific here.] [...] > It's unclear whether we should call a function "purely functional" > if it is possible for it to be called with impure arguments (or use > captured values that are impure). If it can, and we require it to > have no side effects and be deterministic in that case, then almost > no useful functions are pure. > > To dodge this issue, let's provisionally call a function *instance* > "copacetic" [*] if: > - that instance has only captured copacetic values, and > - it has no side effects and is deterministic whenever it is > only called with copacetic argument values, and > - it uses no side-effecting or nondeterministic primitives.
I should also have specified that - primitive immutable values are copacetic, - frozen objects that directly refer only to copacetic values are copacetic, - no values are copacetic unless they can be inferred to be so by the rules above. I think this corresponds to the Functional auditor in E (see <http://www.erights.org/elang/kernel/auditors/>). Is that correct? -- David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com
signature.asc
Description: OpenPGP digital signature
