Re: Syntax idea: Constructors

On Dec 11, 2012, at 11:45 AM, Ryan Sleevi <sleevi@google.com> wrote:

> On Tue, Dec 11, 2012 at 6:03 AM, Richard Barnes <rbarnes@bbn.com> wrote:
>> This might be a simple question, but I wanted to see what the group's thoughts are.
>> 
>> Right now, a lot of the API is devoted to createFoo() methods.  Is there any reason for these not to just be constructors for new object types?  For example:
>> 
>> OLD: var d = window.crypto.createDigester("sha256");
>> NEW: var d = new Digest("SHA-256");
>> 
>> It doesn't really seem like the various operations are sharing any resources, so they don't really need to be tied back to the master Crypto interface.
>> 
>> Humbly submitted,
>> --Richard
> 
> Hi Richard,
> 
> I wasn't sure if you were on the last call (Monday), but I did send
> out an announcement about the updates to the editor's draft, available
> at https://dvcs.w3.org/hg/webcrypto-api/raw-file/f5e8d9a3e18f/spec/Overview.html
> 
> You will see that the createVerb-er methods have been renamed to
> "verb", and return Promises-like objects.
> 
> I also raised this issue back in August, as ISSUE-37, and discussed
> some of the pros and cons there.
> 
> Still, please take a look at the latest editor's draft and provide
> feedback, since this is being proposed as the next public working
> draft (for discussion on next week's call)

Great, thanks.  I will take a look at those pointers and provide feedback.

--Richard

Received on Tuesday, 11 December 2012 16:50:09 UTC