Re: [webidl] Stringifiers should allow optional arguments

On 7/9/14, 11:51 AM, Robin Berjon wrote:
> And if we could kill serializer with the same stone, all the better.

Serializer is a tad different.

The issue with stringifier is that it doesn't actually describe the 
behavior.  It just specifies that a toString method is created, but what 
that toString method does has to be described in prose.  So there is no 
significant win over just having "toString" in the IDL with prose 
describing the behavior, except in terms of language-independence.

For serializer, it can provide behavior, not just a function name.  So 
replacing it would involve a lot more prose.

On the other hand, I think serializer as currently specified is somewhat 
over-engineered.  In practice, Gecko implements only the "serializer = { 
attribute };" form (and we give it a different name, "jsonifier", in our 
IDL to make it clear that it's not the thing that's in the spec).  This 
is the form that most closely corresponds to what people may want when 
they JSON.stringify an object in practice.  Are there actual use cases 
for the other forms that warrant having them in IDL?

-Boris

Received on Wednesday, 9 July 2014 16:14:45 UTC