Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perlfunc: document that sort is stable, remove 'use sort' references #22287

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

mauke
Copy link
Contributor

@mauke mauke commented Jun 16, 2024

No description provided.

@Grinnz
Copy link
Contributor

Grinnz commented Jun 16, 2024

It's definitely worth documenting that this is how it currently works, but do we want to provide a guarantee? I suppose at this point it would be just as difficult to change that either way.

@jkeenan
Copy link
Contributor

jkeenan commented Jun 16, 2024

It's definitely worth documenting that this is how it currently works, but do we want to provide a guarantee? I suppose at this point it would be just as difficult to change that either way.

The DESCRIPTION section of perldoc sort is quite emphatic that we're not changing how sort works:

    The default sort has been stable since v5.8.0, and given this consistent
    behaviour for almost two decades, everyone has come to assume stability.

    Stability will remain the default - hence there is no need for a pragma
    for code to opt into stability "just in case" this changes - it won't.

    We do not foresee going back to offering multiple implementations of
    general purpose sorting - hence there is no future need to offer a
    pragma to choose between them.
...
    We are not averse to changing the sort algorithm, but we don't see the
    benefit in offering the choice of two general purpose implementations.

@Perl Perl deleted a comment Jun 17, 2024
The `use sort 'defaults';` line used only one tab before the comment;
the other lines had two. This renders inconsistently depending on how
much initial space is used in the output (and where the tab stops are).

For example, <https://perldoc.perl.org/sort#SYNOPSIS> looked like

    use sort 'stable';              # guarantee stability
    use sort 'defaults';    # revert to default behavior
    no  sort 'stable';              # stability not important

Using spaces ensures the "#" signs are aligned everywhere.
@mauke mauke merged commit 9e4e463 into Perl:blead Jun 19, 2024
29 checks passed
@mauke mauke deleted the doc-sort branch June 19, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants