On Thu, 26 Jan 2012 21:23:46 -0600, Glenn Maynard <[email protected]> wrote:

On Thu, Jan 26, 2012 at 7:01 PM, Tab Atkins Jr. <[email protected]>
 wrote:

That's not necessary.  There are situations when optional arguments
make sense.  They should be avoided, though, when you expect that
*future* optional arguments will have nothing to do with the current
one, as otherwise you'll have to specify the "optional" argument every
time with some null value.

Charles gives examples of a few arguments we may want to provide in
the future, all of which have nothing to do with whether the url is
single-use or reusable.


This is all fine.  It's only the argument that booleans are so much more
opaque than other argument types (numbers, at least) that I find
unconvincing.

As someone who occasionally has to look up if the 3rd argument to XMLHttpRequest.open() means sync or async, I agree with Tab. And that's something I've been using for years. Forget about synthetic keyboard events [1]:

event.initKeyEvent("keypress", true, true, null, null, false, false, false, false, 9, 0);

[1] Example cribbed from http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html

--
Mike Taylor
Opera Software

Reply via email to