precisely and agreed 100%, this was my point again ... we know **now** that monocle mustache is good and we would like to change last minute some ES6 collection in a redundant way, accordingly with what we know already is going to be good for ES6 ?
As so, if returning `this` cannot be accomplished otherwise, returning the value cannot be accomplished as well so what is exactly that point about? I believe the most common JS pattern out there is this one: obp.prop = obj.prop || value; Above pattern is a mistake already, specially in an Object.observe or new Proxy prospective, where getters, records, or setters, are invoked all the time compared with this pattern which is promoted by me constantly but ignored by the community "prop" in obj || (obj.prop = value); The community is not always aware about the possibility to have Object.observer or new Proxy but will follow the known pattern regardless tomorrow. That pattern is: var valueINeed = "prop" in obj ? obj.prop : obj.prop = value; so that they can use `valueINeed` whenever they want passing through the obj.property JavaScript makes this easy to manipulate/use and hard to deeply explain in details (which is one of the wins of the language, by the way) so I think an equivalent: var valueINedd = obj.get(key) || obj.set(key, value) is helping much more the community than an implicit returning get. Said that, we should also consider that whoever would like to implement a library that returns `this` rather than the value will do in any case, same way I have implemented what I am talking about in my HybridMap proposal (in github and I am not going to put the link here, is just ES6-collections with returning value and a meaningful delete(key):boolean ) br On Sun, Jan 13, 2013 at 8:33 PM, Nathan Wall <[email protected]> wrote: > Allen Wirfs-Brock wrote: > > if we excluded the cascade result at the API design level then we are > > making it impossible for those who like the cascade pattern from using > it. > > The biggest thing I got out of the discussion Mark linked to is that the > cascade pattern is potentially supportable with an operator in a future ES. > It seems like if there's a pretty good possibility a cascade operator will > be something we can look forward to in ES7, then it'd be redundant to have > methods which return `this` -- which frees up mutation methods to return > other, potentially meaningful things (true/false for delete, value for set, > etc). > > Nathan > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

