Skip to content

[RFC] Naming convention for in-place mutating procs #7551

@mratsim

Description

@mratsim

Disclaimer: this only applies to procs with a mutating and non-mutating version. Not procs like pop that always mutate.

Context

There seems to be 2 conventions currently for proc that either mutate their arguments in-place or return a new T:

  • Prefixing with a m for the mutating version:
    • items and mitems
    • pairs and mpairs
  • Have the verb be the in-place mutation and the past participle return a new T
    • reverse and reversed in algorithm
    • sort and sorted
    • rotate and rotated

History

A long time ago (September 2017), I was trying to find a name for in-place reciprocal (x -> 1/x), ensue a conversation on IRC with various propositions including reciprocaled and mreciprocal

Proposal

Some names are very strange to "-ed" but we can always prefix with a m. I would like to make all the new procs that accept out-of-place and in-place versions use the m prefix for their in-place version.

I also would like to add that to NEP-1.

Transition for current procs

I have no idea

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions