Michael Sperber scripsit:
> > Also, the sample implementation is still using a procedural value for
> > no good reason, now that it is possible to make a new record type.
>
> On the other hand (leaving aside the more general question of
> improvements to promises discussed elsewhere), why would a new record
> type be preferable?
First of all, I think the sample implementation ought to be removed
from the standard itself into the realm of reference implementations.
That said, I believe the reference implementation ought to use a
record type, because that makes it easy to implement the extended
semantics whereby "force" applied to a non-promise is the identity.
This cannot be done without using a type of some sort, as there
is no way in general to tell a promise from just any procedure.
Finally, I believe that this extended semantics ought to be the
standard semantics, and that all talk of implicit forcing (that
is, the second and third bullet points) ought be removed from the
standard: has anyone ever implemented it?
So we wind up with "force" applicable to any object: it forces
promises (a disjoint type) and memoizes and returns the result,
and returns non-promises as is.
--
John Cowan cowan_at_ccil.org http://ccil.org/~cowan
"The exception proves the rule." Dimbulbs think: "Your counterexample proves
my theory." Latin students think "'Probat' means 'tests': the exception puts
the rule to the proof." But legal historians know it means "Evidence for an
exception is evidence of the existence of a rule in cases not excepted from."
Received on Sun Nov 26 2006 - 12:27:06 UTC