set.delete method name
Brendan Eich
brendan at mozilla.org
Sun Feb 12 13:46:49 PST 2012
Agreed, my "remove is the best all-around name" was biased toward the
past. We can hang tough. This isn't a huge hardship. Indeed way back in
1996 when Nick Thompson and I connected JS and Java at Netscape, some
Java APIs required, e.g. file['delete']() instead of file.delete(). I
wish I had not reserved property names in '95. Fixed in ES5!
/be
Mark S. Miller wrote:
> 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 <mailto: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 <mailto:es-discuss at mozilla.org>
> https://mail.mozilla.org/listinfo/es-discuss
>
>
>
>
> --
> Cheers,
> --MarkM
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
More information about the es-discuss
mailing list