(Map|Set|WeakMap)#set() returns `this` ?

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Dec 4 12:07:09 PST 2012


it would be nice to add a #put(key, value) that returns value and see what
developers prefer on daily basis tasks :-)

anyway, if it won't change, it's OK, I had my answer, thanks


On Tue, Dec 4, 2012 at 12:03 PM, Rick Waldron <waldron.rick at gmail.com>wrote:

>
>
>
> On Tue, Dec 4, 2012 at 2:46 PM, Andrea Giammarchi <
> andrea.giammarchi at gmail.com> wrote:
>
>> for develoeprs I meant jQuery users too, being one of th emost popular
>> API out there.
>>
>> What I meant with jQuery#add method is that last thing added is the one
>> returned, it does nto return the initial object, it returns the new result
>> out of a merge but this is not the initial this, this is a new thing with
>> latest added thing in.
>>
>
> That is exactly what I described—the case for returning a fresh jQuery
> object exists to support end() (http://api.jquery.com/end/) which allows
> you to chain operations (eg. filter->apply css or something) and restore
> the original jQuery object (matching set of elements) by keeping a
> reference to that object stored as a property of the new jQuery object.
> This mechanism is irrelevant in the comparison of Set API semantics.
>
> Rick
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121204/9c21a8d4/attachment.html>


More information about the es-discuss mailing list