Additional cascading Map/Set/WeakMap methods?

Axel Rauschmayer axel at rauschma.de
Sun Jan 13 17:56:17 PST 2013


Another possibility is to let map.delete(key) return the mapped value (a bit like Array.prototype.pop()). But I’m not sure how useful that is, either.

On Jan 14, 2013, at 2:23 , Brandon Benvie <brandon at brandonbenvie.com> wrote:

> Personally, I've never used the result of `collection.delete` for anything and I'm not confident that the use case exists. I just wanted to note what was being lost by changing the return value.
> 
> 
> On Sun, Jan 13, 2013 at 8:21 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> On Sun, Jan 13, 2013 at 5:14 PM, Brandon Benvie
> <brandon at brandonbenvie.com> wrote:
> > delete is supposed to return whether the item was in the collection to
> > delete or not, which otherwise would require using has to check for before
> > deleting. I don't know how useful the functionality is, but wanted to note
> > it since it'd be lost with this change. Chaining `clear` is an easy
> > definitely though.
> 
> Why would it require such? Are you expecting it to throw if you try to
> delete something that's not there?  Or just wanting to use delete() as
> a destructive sampling method on the Map?
> 
> ~TJ
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130114/41cd0ff4/attachment-0001.html>


More information about the es-discuss mailing list