W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: Future cancellation

From: Sam L'ecuyer <sam@cateches.is>
Date: Tue, 30 Apr 2013 15:11:44 -0400 (EDT)
To: "Kevin Gadd" <kevin.gadd@gmail.com>
Cc: "Brendan Eich" <brendan@mozilla.com>, "es-discuss" <es-discuss@mozilla.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <1367349104.76969958@apps.rackspace.com>

> I don't know what the right shape for a cancellation API is,  but one
> should not assume that this problem is inherent to cancellation. I don't
> think it is. 

Take my input with a grain of salt, but I think it is.

Futures form a cascading pipeline (a series of tubes, if you will) that it promises to follow, either succeeding or failing but always continuing.  Cancellation doesn't fit that model, because it involves either destructively reshaping the pipeline after it's started or trying to shove events in the wrong direction.  If a value is no longer needed and you know ahead of time that it may not be, then a) keep the resolver and reject (reject() takes a value.  Use it.), or b) put an `if` in the success callback.  

-sam
Received on Tuesday, 30 April 2013 19:12:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC