This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25391 - Add default to a sequence e.g. sequence<DOMString> = [];
Summary: Add default to a sequence e.g. sequence<DOMString> = [];
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebIDL (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Cameron McCormack
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2014-04-18 20:55 UTC by Jan-Ivar Bruaroey [:jib]
Modified: 2014-06-16 19:04 UTC (History)
3 users (show)

See Also:


Description Jan-Ivar Bruaroey [:jib] 2014-04-18 20:55:57 UTC
Sometimes knowing the difference between someone passing in an empty sequence versus nothing is useful, but at other times an invariant that didn't care would be better.

In the latter case, the Optional<>::WasPassed() and Optional<>::Value() bindings get in the way when assuming an empty array would make for simpler code.
Comment 1 Cameron McCormack 2014-06-16 06:03:35 UTC
Thanks, I've added this now:
Comment 2 Boris Zbarsky 2014-06-16 19:01:44 UTC
Shouldn't we only allow [] for nullable sequence types, not all nullable types?

But also, we should allow it for unions containing sequence, imo.
Comment 3 Boris Zbarsky 2014-06-16 19:04:06 UTC
Also, "The type of this value is the same the type" is missing an "as".