in reply to Re: sort AoH buggy?
in thread sort AoH buggy?

Well... I never ever see comparison routines in the form

used.

If you really need a special sort it's normally far easier to write

They are useful when combining them in multi_sorts with other comparisons, like ...

... , but in this case you are always free to surround single my_comps with curlies.

I'd say this syntax should be deprecated.

(Unless someone could show me useful applications)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^3: sort AoH buggy? (deprecation candidate)
by jdporter (Paladin) on Dec 10, 2021 at 13:00 UTC
    I'd say this syntax should be deprecated.

    I assume you're referring to the sort my_comp LIST syntax. Otherwise, you're just ... wrong.

    But what would be the point of deprecating? What harm does it cause? Deprecating it would only serve to break the few instances of code out there that use it.

    I reckon we are the only monastery ever to have a dungeon staffed with 16,000 zombies.
      It's causing more damage than benefit and fixing old code is easy. Plus a pragma could switch it back on.

      > I assume you're referring to the sort my_comp LIST syntax

      Obviously like discussed.

      See also the perldoc choroba quoted, one case is just distinguished by a whitespace.

      I just trained a new Perl programmer and gave him a set of orthogonal rules how to read and (de)construct the syntax, instead of relying on try-and-error ...

      Which was hard enough, the perldocs already read like spaghetti code.

      Now I have no idea how to justify that useless folly.

      The more logical Perl is constructed, the easier it is to promote.

      I'm still waiting for someone giving me a usecase were this syntax gives any benefit justifying the costs.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        It's causing more damage than benefit

        IYHO, of course. Personally speaking I see it as neither a huge boon nor a terrible disaster.

        and fixing old code is easy

        It really isn't. Technical debt is a huge problem within the industry - just ask any COBOL programmer (if they will let you onto their superyacht). I have seen comments like

        # This next line is essential for this subroutine to work but I don't +know why. # DO NOT TOUCH OR REMOVE IT!

        too many times to be shocked or surprised. Any time you touch old code you risk breakage and the older the code the higher the risk.

        The more logical Perl is constructed, the easier it is to promote.

        Completely agree (so long as it doesn't end up just being a dialect of python ;-p)


        🦛

        Obviously like discussed.

        It was not obvious. In fact it was quite unclear. Because you wrote the following, and I quote:

        sort { my_comp } LIST
        I'd say this syntax should be deprecated.

        That's why I asked.

        I reckon we are the only monastery ever to have a dungeon staffed with 16,000 zombies.
A reply falls below the community's threshold of quality. You may see it by logging in.