Re: What changes to Web Messaging spec are proposed? [Was: Re: Using ArrayBuffer as payload for binary data to/from Web Workers]

On Wed, Jun 22, 2011 at 2:31 AM, Glenn Maynard <> wrote:

> On Wed, Jun 22, 2011 at 4:33 AM, David Levin <> wrote:
>> Making people use a helper function like that is just making them jump an
>>> unnecessary hoop.
>> It makes them jump through another hoop to potentially misuse the api.
> No, it's another hoop that *everyone* has to jump through to use the API at
> all, so code you write in browser N+1 would also work in browser N where
> fewer classes support transfer.
> Jumping that hoop is not the misuse; it's a direct requirement of the API.
> *Because* everyone would be doing that, the misuse will also be possible.

The throwing aspect is a useful debugging tool to warn developers about
misuse that they wouldn't be aware of otherwise. (Not everyone will read the
spec as closely as you do -- may will just write code to get the job done
and declare it done when it works -- a not throwing api may still be fast
but will be deceptive in allowing parameters and not acting on them leading
to the discussed misuse by accident -- it happens all the time by people who
are trying to be careful even.)

Your given code isn't the only possible solution. However, it is one that
imposes M choose N combinations for the code resulting in lots of testing
combinations. I could easily envision several alternatives to your snippet
which could be written which would be better.  For example, one could write
code that either send all parameters using fast path or none. (This is only
two test cases and they could have a debug switch to make everything be
passed in the fast method to ensue that it worked correctly -- note this
isn't possible if the api doesn't throw.)

I'm fairly certain that we won't agree. Due to my many experiences with
people including myself misusing apis and not realizing it, I strongly
prefer an api that warns of misuse. You don't.

I see either of us saying anything new so I don't plan to continue this
discussion further because I believe that we have both laid our points of
view in vivid detail :).

best wishes,

Received on Wednesday, 22 June 2011 15:39:24 UTC