set.empty() method

Brendan Eich brendan at mozilla.org
Tue Feb 14 22:37:13 PST 2012


Good idea, but I suggest an unambiguous verb instead of an 
adjective-or-verb: clear.

"empty" is often used for the predicate, in naming conventions that 
eschew "isEmpty" and "emptyp" patterns.

/be

Peter Michaux wrote:
> If some piece of code needs to empty a set, it would be good to do
> that in a single call
>
>      set.empty();
>
> Otherwise we might be left doing the following which could be very inefficient.
>
>      set.forEach(function(element) {
>          set['delete'](element);
>      });
>
> Peter
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list