RE: URLSearchParams: calling .set() and .append() should return itself

From: Marcos Caceres [mailto:marcos@marcosc.com] 

> Could I kindly ask for some clarification or a pointer from TC-39 members? If not returning the object, is there a new pattern?

I think it would be more accurate to say the pattern is contentious among TC39 members. I think it's terrible; it violates basic software engineering principles like command-query separation [1] in order to save a few characters of typing.

However, my guess would be that future collection classes designed by TC39 will continue this tradition, simply for consistency. This is similar to many other contentious decisions that we will probably carry forward forever, like adding a `thisArg` to all collection map/filter/reduce/etc. methods, or ensuring that all forEach callbacks always get three arguments even when it makes no sense (like for Set).

So it might be appropriate for URLSearchParams.

[1]: https://en.wikipedia.org/wiki/Command%E2%80%93query_separation

Received on Monday, 29 February 2016 12:56:43 UTC