set.delete method name

Mark S. Miller erights at google.com
Sun Feb 12 13:43:47 PST 2012


I feel strongly that "delete" is the right name for this. Currently, all
the method names (get, set, has, delete) relate directly to the names
associated with these operations when applied to properties, making them
more mnemonic.

The need to say collection['delete'](...) rather than
collection.delete(...) is only a temporary measure until the ES3 browsers
fade out enough to either 1) be ignored, or 2) be supported only as the
target of an ES5/6 -> ES3 translation. Granted this will take years. But
we'll be living with these choices for many more years after that.


On Sat, Feb 11, 2012 at 11:11 PM, Peter Michaux <petermichaux at gmail.com>wrote:

> The Set proposal has a "delete" method. Old ECMAScript implementations
> do not allow "delete" to appear as a bare method name like
> set.delete('foo') and it is necessary to write the awkward
> set['delete']('foo'). Because of this and knowing polyfills will be
> written to support Set in older implementations, would it be better to
> choose "remove" as the method name so that set.remove('foo') can be
> written in the older implementations? I think this would save a lot of
> unnecessary debugging for cross-browser programming.
>
> Peter
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120212/796c1348/attachment.html>


More information about the es-discuss mailing list