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: Fri, 11 Jul 2014 12:35:18 -0400
Message-ID: <53C01246.1050307@mit.edu>
To: Anne van Kesteren <annevk@annevk.nl>
CC: "Tab Atkins Jr." <jackalmage@gmail.com>, Robin Berjon <robin@w3.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 7/11/14, 12:30 PM, Anne van Kesteren wrote:
> On Fri, Jul 11, 2014 at 4:52 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> In cases when you do "stringifier attribute", sure.  It saves you the
>> trouble of having:
>>    attribute DOMString foo;
>>    DOMString toString();
>> and prose that says that invoking toString() does the same thing as the foo
>> getter.  Which is not very much trouble, imo, compared to what a typical
>> toJSON prose description would need to do.
> I guess that would depend on the situation. For both it seems you
> could define an abstract operation and then define the attribute and
> method that have equal behavior in terms of that abstraction.

The toJSON case doesn't usually have an attribute that produces the JSON 
stringification (in fact, I can't think of any cases when that would be 
desirable), so you'd need to create the (fairly complicated!) abstract 
operation just for the toJSON to use.

Received on Friday, 11 July 2014 16:35:48 UTC

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