[Bug 23532] Dealing with undefined

https://www.w3.org/Bugs/Public/show_bug.cgi?id=23532

--- Comment #21 from Jonas Sicking <jonas@sicking.cc> ---
If the goal is "treat passing undefined the same as not passing the argument at
all, even for non-optional arguments", then we actually have two options:

For a function like "void func(double arg)"

A) Make both func() and func(undefined) throw TypeError.
B) Make both func() and func(undefined) be equivalent to
   func(ToNumber(undefined)), i.e. equivalent to func(NaN).

So far we've mostly debated A, which doesn't seem very web compatible.

We certainly could do A for any new functions added to the platform, however
that would create inconsistency between old and new functions which is
unfortunate.

B is likely much more web compatible, and could probably be done for both old
and new APIs. Not throwing also feels a lot more "javascripty", but that's
obviously a matter of opinion.

I even *think* WebKit (and thus Blink) has done B for a long time.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Wednesday, 23 October 2013 20:52:35 UTC