Skip to content

stdlib naming inconsistencies #626

@subsetpark

Description

@subsetpark

The standard lib has a couple different naming conventions that conflict with each other.

For instance, the stdlib has functions for two common operations on sequences: sorting and reversing. Each one has an effectful and a non-effectful variant, which mutate the existing data structure or return a new one respectively. However, they abide by different conventions to communicate this.

For reversing a sequence, the effectful variant is reverse! and the functional one is reverse, using the common lisp convention of ! to indicate an effectful function.

On the other hand, sorting uses sort and sorted respectively, following a convention most familiar to me in Python.

I personally think the former convention is a little nicer and more productive, but arguably having a consistent naming scheme in either direction would be a step forward.

Since this is a breaking change, we could introduce sort! as a synonym for sort without necessarily removing sort. We couldn't make a non-breaking change in the other direction, introducing reversed, because the presence of reversed would imply that reverse had effectful semantics.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions