W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2013

[Bug 23532] Dealing with undefined

From: <bugzilla@jessica.w3.org>
Date: Wed, 23 Oct 2013 20:52:32 +0000
To: public-script-coord@w3.org
Message-ID: <bug-23532-3890-UE58VxIgFS@http.www.w3.org/Bugs/Public/>

--- 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

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:18 UTC