Map/Set.prototype.size

Rick Waldron waldron.rick at gmail.com
Fri Oct 12 08:41:33 PDT 2012


Would .size be {[[Writable]]:false}?

let s = new Set([1,2,3,4]);

s.size; // 4

s.size = 1; // fail silently (loudly in strict mode)?


I swear there was some discussion either at an in-person on this list, but
I'm having no luck tracking it down...


Rick


On Fri, Oct 12, 2012 at 11:28 AM, Alex Russell <slightlyoff at google.com>wrote:

> +1
>
>
> On Fri, Oct 12, 2012 at 4:19 PM, Erik Arvidsson <erik.arvidsson at gmail.com>wrote:
>
>> +1
>>
>> On Fri, Oct 12, 2012 at 11:16 AM, David Bruant <bruant.d at gmail.com>
>> wrote:
>> > Hi,
>> >
>> > Firefox has implement a Map/Set.prototype.size *method* to query the
>> number
>> > of mapping/elements.
>> > It's not in the strawman. It appears in the latest draft, though weirdly
>> > enough Map.prototype.size is a function with an unused argument.
>> > What about making it an getter instead of a function? I guess we also
>> don't
>> > need the extra parens to request for Map#keys, Map#values, Map#items.
>> >
>> > Unlike Java, JavaScript is lucky enough to have getter/setters, we
>> should
>> > use them, even in the spec. The boat for myArray.length has sunk a while
>> > ago, but new constructs can get this right.
>> >
>> > David
>> >
>> > _______________________________________________
>> > es-discuss mailing list
>> > es-discuss at mozilla.org
>> > https://mail.mozilla.org/listinfo/es-discuss
>> >
>>
>>
>>
>> --
>> erik
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121012/16e998b6/attachment-0001.html>


More information about the es-discuss mailing list