Re: [Bindings] stringify

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.

  http://lists.w3.org/Archives/Member/member-webapi-cvs/2007Dec/0009.html

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