qtspecs icon indicating copy to clipboard operation
qtspecs copied to clipboard

transient() - a function to make functions nondeterministic

Open michaelhkay opened this issue 9 months ago • 39 comments

I propose a function transient() which takes a function as input and returns a function that is functionally identical, but which relaxes the requirement for determinism.

For example, transient(current-dateTime#0) returns a function that returns a date and time, but is not required to return the same date and time on every call, while transient(doc#1) returns a function that dereferences an XML document URI, but is not required to return the same document every time it is called with the same URI.

A valid implementation, of course, could return the supplied function unchanged - the transient() function gives the implementation the freedom to relax the rules, but does not require it to do so.

transient() seems like a more friendly name than nondeterministic().

michaelhkay avatar May 01 '24 20:05 michaelhkay