Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Seamless Sort #182

@suni-masuno

Description

@suni-masuno

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions