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 12816 - Make second argument in constructor an object for future extensibility
Summary: Make second argument in constructor an object for future extensibility
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebSocket API (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2011-05-30 07:21 UTC by contributor
Modified: 2011-07-07 19:57 UTC (History)
6 users (show)

See Also:


Description contributor 2011-05-30 07:21:22 UTC

Make second argument in constructor an object for future extensibility

Posted from: by
User agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.5.8; U; en) Presto/2.8.131 Version/11.11
Comment 1 Ian 'Hixie' Hickson 2011-05-31 19:59:49 UTC
Why does this help with future extensibility?

We can always overload the first argument if necessary.
Comment 2 Jonas Sicking (Not reading bugmail) 2011-05-31 22:29:59 UTC
It makes future expansions more consistent with current code. I.e. the API that we'll have in the future will be a cleaner one.

The downside of course is if we don't add future arguments at all, then we've created unnecessarily complex syntax.

But the list in [1] contains some fairly plausible properties.

Comment 3 Ian 'Hixie' Hickson 2011-06-21 07:20:15 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:

Status: Rejected
Change Description: no spec change
Rationale: I'm not really convinced this is needed. While we may add some of the things in the cited e-mail, it's unlikely we'd add many of them as immutable construction-time-only features rather than just as attributes that can be changed arbitrarily.

If we ever need to, we can always make the API wait until the event loop spins before doing anything, in which case we can expose any optional construction-time argument we want as object attributes, without having an open() method.
Comment 4 Jonas Sicking (Not reading bugmail) 2011-06-21 07:38:32 UTC
I don't think waiting for the event loop is an option as that can delay starting the network traffic for a non-trivial amount of time. Especially in web workers. In fact, in web workers it's entirely possible that we'll add support for a synchronous websocket API where waiting for the event loop isn't possible at all.

So I think the question comes down to how likely we think it is that we'll introduce further properties like the ones listed in the email linked in comment 2.

It's also a question how often we think that people will use the existing second constructor argument since only when it's used will it benefit from the current shorter syntax compared to the proposed one.

If other vendors want to go the second-argument-must-be-a-object route then I'm willing to follow that.
Comment 5 Adrian Bateman [MSFT] 2011-07-07 19:57:13 UTC
Microsoft supports the second argument as object approach. See