set.delete method name

Andrea Giammarchi andrea.giammarchi at gmail.com
Sun Feb 12 11:07:50 PST 2012


remove is OK too, I proposed del 'cause used already in Python and probably
others and it's just a shortcut for the action ... I would mind an "escape"
button in my keyboard :-)

br

On Sun, Feb 12, 2012 at 7:45 PM, Brendan Eich <brendan at mozilla.org> wrote:

> JS avoids cybercrud names where possible, following Java which followed
> Smalltalk. But we do prefer concise verb-only methods where possible (no
> Kingdom of Nouns AbstractFactoryFactoryImpl names as in real-world Java;
> Smalltalk is better precedent but message selectors can afford to be more
> verbose when strung together than a single method name in JS should be).
>
> So 'del' is too short. We had remove at some point, could go back to it.
> That seems like the best all-around name.
>
> Thinking of collection *protocols* with suites of methods that have
> canonical names (get, force, set, has, remove) helps.
>
> /be
>
> Andrea Giammarchi wrote:
>
>> to me "del" was simply good enough, at least as fallback
>>
>> On Sun, Feb 12, 2012 at 6:22 PM, Rick Waldron <waldron.rick at gmail.com<mailto:
>> waldron.rick at gmail.com**>> wrote:
>>
>>    It would be tragic to determine future APIs based on _broken_
>>    implementations of historic/archaic browsers - especially in an
>>    age where the browser isn't the only "client" of the spec.
>>
>>
>>    Rick
>>
>>    On Feb 12, 2012, at 7:24 AM, Andrea Giammarchi
>>    <andrea.giammarchi at gmail.com <mailto:andrea.giammarchi@**gmail.com<andrea.giammarchi at gmail.com>
>> >>
>>    wrote:
>>
>>     +1
>>>
>>>    had same thoughts when I wrote this:
>>>    https://github.com/**WebReflection/es6-collections<https://github.com/WebReflection/es6-collections>
>>>
>>>    then I have realized older IE compatibility requires the usage of
>>>    the string but I would have rather suggested
>>>
>>>    del
>>>
>>>    instead of remove so get, set, has, del ... all 3 chars, no
>>>    problems with reserved keywords
>>>
>>>    br
>>>
>>>
>>>
>>>    On Sun, Feb 12, 2012 at 8:11 AM, 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<https://mail.mozilla.org/listinfo/es-discuss>
>>>
>>>
>>>    ______________________________**_________________
>>>    es-discuss mailing list
>>>    es-discuss at mozilla.org <mailto:es-discuss at mozilla.org**>
>>>    https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>>>
>>
>>
>> ______________________________**_________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120212/46ec8550/attachment-0001.html>


More information about the es-discuss mailing list