Re: [webidl] Please rename things that are legacy so it's clear they are (#100)

Why is callback interface supposed to be legacy?  Except for the single-function case (which should use a callback instead), its a perfectly reasonable API design.  The other option is a list of callbacks, which has its own benefits and drawbacks.

Note that the consumer can shim a "list of callbacks" interface on top of a callback interface by creating a dummy object, just like one can shim a "callback interface" interface on top of a list of callbacks by binding all the methods to the "this" object and passing them in.  So in practice the API design choice should be mostly informed by how many callbacks there are and whether it makes sense to have them be methods of a single object conceptually.

For the case of one callback, clearly just a callback function is better.  For two callbacks, unclear.  For 10 callbacks, I would argue that a callback interface is a much better representation than a flat list; at least as an API consumer I would prefer to not have to count my function arguments to see which one is which.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/100#issuecomment-199258378

Received on Monday, 21 March 2016 12:54:52 UTC