Dear Geo WG,
I am writing to you on behalf of the DAP WG. We have been discussing various styles of parameter passing for our APIs, and there is a tendency to lean towards the object literal style. However we noted while discussing this that that isn't the approach you had taken. This mostly concerns API calls that involve callbacks (of which we have many).
To provide examples, you have APIs set up like this:
navigator.geolocation.getCurrentPosition(successCB, errCB, { option: "foo", option2: "bar"});
Since the error callback is optional, but options are useful, this leads to things like:
navigator.geolocation.getCurrentPosition(successCB, null, { option: "dahut" });
We were thinking about going to full object literal:
navigator.device.doSomethingCool({ success: scb, error: ecb, dahut: true, unicorn: false });
Our question isn't "what do you prefer?" as we'd like to avoid a cross-list discussion about who likes which style best but rather "did you discuss these differences, and if so what motivated your choice and can we please have a pointer to that discussion?" (I looked in the archives but didn't find it). If you had a rationale we'd be very interested in hearing it, and if you didn't (e.g. because that just happened to be the shape of what was proposed and no one complained) that's fine, we'll make our own.
Thanks a lot!
PS: Tracker, you owe me a cookie for ACTION-120.
--
Robin Berjon
robineko â€” hired gun, higher standards
http://robineko.com/