[Bug 23532] Dealing with undefined

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

--- Comment #17 from Erik Arvidsson <arv@chromium.org> ---
I believe the rules in comment #0 are a bit too simplistic. For example passing
undefined to a required boolean parameter needs to coerce it to false.

I believe the following rules would work.

1. Treat all nullable and boolean trailing parameters as optional. If there are
optional parameters after a required parameter treat it as if it was optional.

  void foo(boolean b, optional T t)

would be treated as 

 void foo(optional boolean b = false, optional T t)

2. Treat all trailing nullable required parameters as optional, default to
null.
3. For nullable required parameters treat undefined as null.
4. For boolean required parameters treat undefined as false.
5. For other required parameters, undefined and missing is an error.
6. For other optional parameters, undefined triggers the default

I think this can be simplified further but the main point is that we should be
able to pass undefined to nullable and boolean parameters.

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

Received on Wednesday, 23 October 2013 15:55:11 UTC