I'm using seamless in a substantial production project (and loving it by the way) and we are consistently struggling with one minor annoyance, .sort()
My daydream scenario is an override on any immutable array that gives me .sort() that does not mutate and returns an immutable copy, like map, filter, and reduce appear to do. But I'm open if there's a different preferred solution.
Right now we find ourselves using either
[].concat(functionChain).sort(comparator)
for when we MIGHT be immutable (IE when we're first wiring together some stuff) and
functionChain.asMutabe().sort(comparator) for when we know we are.
This is working ok, so it isn't too urgent, but an override feels like it would be very elegant and result in much more readable and portable code. It also seems a little more 'seamless' ^_^
EDIT: I might note that I understand why it currently throws the error it does, and perhaps a seamless version of sort should be put under a different name, allowing the old mutating method to continue throwing an error. I think there may be some reasonable debate there and I'm not overly committed to either side.
I'm using seamless in a substantial production project (and loving it by the way) and we are consistently struggling with one minor annoyance, .sort()
My daydream scenario is an override on any immutable array that gives me .sort() that does not mutate and returns an immutable copy, like map, filter, and reduce appear to do. But I'm open if there's a different preferred solution.
Right now we find ourselves using either
[].concat(functionChain).sort(comparator)for when we MIGHT be immutable (IE when we're first wiring together some stuff) and
functionChain.asMutabe().sort(comparator)for when we know we are.This is working ok, so it isn't too urgent, but an override feels like it would be very elegant and result in much more readable and portable code. It also seems a little more 'seamless' ^_^
EDIT: I might note that I understand why it currently throws the error it does, and perhaps a seamless version of sort should be put under a different name, allowing the old mutating method to continue throwing an error. I think there may be some reasonable debate there and I'm not overly committed to either side.