[racket-dev] promise vs polym contracts

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Jul 7 10:23:39 EDT 2012

I may have made a mistake under time pressure: 

 [else (+ (force (sum (car x))) (force (sum (cdr x))))]

On Jul 7, 2012, at 10:19 AM, Sam Tobin-Hochstadt wrote:

> On Sat, Jul 7, 2012 at 10:14 AM, Matthias Felleisen
> <matthias at ccs.neu.edu> wrote:
>> p.s. Sam's version forces too early because strict functions should
>> force not variable lookups. This is a common misconception among programmers.
>> I suspect it goes back to Abelson and Sussman getting it wrong (see what
>> happens if you don't understand the foundations).
> I still don't think my version forces too early -- your alternative
> contains no calls to `force` at all.  Are you suggesting that I should
> `force` around the recursive calls to `sum`?  In that case, clients
> are exposed to promises, and the result type is (U Integer (Promise
> Integer)).  I can't tell from your description if you think that's an
> acceptable result.
> -- 
> sam th
> samth at ccs.neu.edu

Posted on the dev mailing list.