Re: Attributes! (Re: Proposal: Add RtpSenderInit parameter to addTrack.)

On 5/1/15 7:28 PM, Peter Thatcher wrote:
> As both an implementor and an application developer (perhaps even more 
> an application developer), I want the API to be as simple as possible.

Great, because earlier you said you wanted to:
- allow return values, async and sync, whether you needed them now or 
not, just in case.
- allow async errors.

That did not sound like the simplest API possible.

I want the API to be as simple as possible for the application developer.

> And having to reason about when effects take place across multiple 
> property assignments doesn't sound fun at all, with magic stuff 
> happening underneath to keep it atomic is invariably going to lead to 
> surprising behavior that's hard to reason about.

It's not magic, it's the JavaScript event-loop. JS values are sent to 
the underlying implementation after a dispatch.

Lets reason about your API:

   var params = foo.getParameters();
   params.bar = "big";
   params.fum = " deal";
   foo.setParameters(params).then(() => log("all set!"));

   // Have effects taken place here?

   var params2 = foo.getParameters(); // what's returned?
   log(JSON.stringify(params) == JSON.stringify(params2)); // true?

   params2.bar = "never";
   params2.fum = "mind";
   foo.setParameters(params2).then(() => log("all set!")))

   // What effects have taken place here?

I suspect it's non-deterministic, producing surprising behavior on every 
run.

>   I prefer to keep it simple with one method.

I prefer no method(s).

Here's mine:

   foo.bar = "big";
   foo.fum = " deal";

   // No effects have taken place

   foo.bar = "never";
   foo.fum = "mind";

   // No effects have taken place

   Promise.resolve().then(() => {
     // Effects have taken place
   });

   setTimeout(() => {
     // Effects have taken place
   });

   // No effects have taken place

Highly deterministic.

.: Jan-Ivar :.

Received on Saturday, 2 May 2015 02:29:22 UTC