Re: Updated spec examples with Futures

On Apr 27, 2013 11:40 AM, "Aymeric Vitte" <vitteaymeric@gmail.com> wrote:
>
>
> Le 27/04/2013 01:32, Ryan Sleevi a écrit :
>
>> On Fri, Apr 26, 2013 at 4:23 PM, Aymeric Vitte <vitteaymeric@gmail.com>
wrote:
>>>
>>> Le 25/04/2013 17:02, Ryan Sleevi a écrit :
>>>
>>>> As mentioned before, no.
>>>>
>>>>> var h=window.crypto.digest("sha1");
>>>>> var res1=h.process(stream1);
>>>>> res1.finish().done(
>>>>>      function() {
>>>>>          console.log(this.result); //result 1
>>>>>      }
>>>>> );
>>>>> var res2=res1.process(stream2);
>>>>> res2.finish().done(
>>>>>      function() {
>>>>>          console.log(this.result); //result 1+2
>>>>>      }
>>>>> );
>>>>>
>>> OK, waiting to see the new spec, here the question is not if I can do
this
>>> or not, I can, but this will not produce the correct result
>>>
>> No. It will not do what you want.
>>
>> Once a future is resolved (res1), which is what will happen when the
>> .finish() is sucessfully called, you will no longer be able to call
>> .process() on it further.
>>
>> You don't need to wait for any spec update - this is inherent from
>> http://dom.spec.whatwg.org/#futures
>
>
> I know that when a Future is resolved you can not use it any longer, but
does not res1.finish produce a new Future different from res1? Unless I
misread Futures, that's not very clear. Now, if the different Futures are
using the same underlying material (ie as specified in the spec), then the
example will not work, that's what I mean by "waiting to see the spec".
>

Aymeric, I am trying to indicate to you that what you want will not be
accomplished. Any spec language that suggests otherwise is a spec defect.
That's why you don't need to wait for the spec - if you find any language
suggesting it can be done, its a bug - in the spec.

The CryptoOperation derives from Future - and process()/finish() return
"this".

Even if that were not so, cloning the Future - or the resolver - will not
clone the underlying object or state the Future is acting upon, ergo it
will still not do what you want.

>
> Regards,
>
> --
> jCore
> Email :  avitte@jcore.fr
> iAnonym : http://www.ianonym.com
> node-Tor : https://www.github.com/Ayms/node-Tor
> GitHub : https://www.github.com/Ayms
> Web :    www.jcore.fr
> Webble : www.webble.it
> Extract Widget Mobile : www.extractwidget.com
> BlimpMe! : www.blimpme.com
>

Received on Saturday, 27 April 2013 20:43:36 UTC