W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2014

Re: [webidl] Stringifiers should allow optional arguments

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 09 Jul 2014 12:25:18 -0400
Message-ID: <53BD6CEE.4070009@mit.edu>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: Robin Berjon <robin@w3.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:22 UTC