On Tue, Jun 12, 2012 at 6:09 AM, John Cowan <[email protected]> wrote: > Emmanuel Medernach scripsit: > >> I agree that making a promise with an immediate value could evaluate >> to that immediate instead of creating a promise. > > That's where make-promise (formerly known as eager) comes in: it allows > you to return an object to your caller that is guaranteed to be a > promise. This allows promise-based APIs, where the caller knows he can > safely force the return value.
make-promise no more guarantees a promise than delay does, since there's no way to test for this and the standard gives explicit license to cheat here. >> IMHO for any other usage auto-forcing in primitives strongly sounds >> as being in the "it seems a good idea at that time" department: >> auto-forcing means that primitives have to check if something is a >> promise and forcing it in that case, adding this check add a cost and >> it has deep impact on the language semantics. > > It does add a cost, but the cost is paid only by users of an > implementation (such as Kawa) that does auto-forcing. The impact > is actually quite shallow: it simply makes some functions mildly > polymorphic. Implicit forcing can be done without any overhead except when actually making use of it. -- Alex _______________________________________________ Scheme-reports mailing list [email protected] http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports
