W3C home > Mailing lists > Public > public-webapi@w3.org > December 2007

Re: [Bindings] stringify

From: Cameron McCormack <cam@mcc.id.au>
Date: Mon, 31 Dec 2007 12:49:54 +1100
To: "Web API WG (public)" <public-webapi@w3.org>
Message-ID: <20071231014954.GD15329@arc.mcc.id.au>

Anne van Kesteren:
> Maybe the draft already says something about this, but I couldn't find it.  
> I think it would be good if there was a way in the IDL to say what an  
> object stringifies to. The Window object becomes "[object Window]" and  
> Location stringifies to its href attribute value. The tricky part here is  
> objects implementing multiple interfaces, such as Document and  
> DocumentSelector, but in those cases the specification editors should  
> probably ensure there are no strange things.

Jim Ley:
> Could you describe the use cases for defining this at all?  I can't see any 
> benefits.

Boris Zbarsky:
> Interoperability.  Specifying that Window stringifies to [object Window] 
> is probably unnecessary (and not true in all UAs anyway).  But 
> specifying that, Location stringifies to its .href property is needed 
> (and is interoperably implemented).

It would be interesting to know if there are scripts that rely on
extracting the [[Class]] of DOM objects from that output of
Object.prototype.toString.  I’ve added a [Stringifies] extended
attribute to handle the Location case.


> I've been meaning to address this (or a related issue, anyway) in a
> mail to both ES4-discuss and to WebAPI.
> Wouldn't it be best to specify which interface is the main interface
> for objects? ECMAScript assumes a strict single inheritance scheme.

That’s probably a good idea, and could help simplify some other things
in the spec.

Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au
Received on Monday, 31 December 2007 01:50:18 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:24 UTC