Re: [webidl] Stringifiers should allow optional arguments

On 7/9/14, 12:18 PM, Tab Atkins Jr. wrote:
> And note that just defining a toJSON() method on the object already
> lets you hook JSON.stringify()

Right, but my point is that you still have to define what the toJSON 
will do.

With "serializer = { attribute };" (possibly with simpler syntax!) you 
automatically get a toJSON with the behavior everyone would typically 
expect toJSON to have here.  There's value in having that shortcut so 
spec authors do not have to reinvent that wheel in prose.

-Boris

Received on Wednesday, 9 July 2014 16:25:46 UTC