http://qs321.pair.com?node_id=11109906


in reply to Re^6: RFC: "assignary" operator ?= :
in thread RFC: "assignary" operator ?= :

Just the .pm files in the perl core distribution contain over 700,000 lines. You show that those, combined with a bunch of 3rd party modules, contain only around 100 instances of code likely to be able to make use of this proposed operator.

To be exact, in that amount of code I've found 77 instances.
And I have found 192 lines of code (two and a half times as much) which use the defined-or //=.

If anything I think you've shown that this is a very rare use case and hardly justifies its addition to core.

A bit more rare than the defined-or assignment operator //=, but anyways. Among 700.000 lines, 192 isn't that much either, so rareness of use cases isn't exactly a reason for an operator to be included or not.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^8: RFC: "assignary" operator ?= : (rareness)
by ikegami (Patriarch) on Dec 10, 2019 at 20:46 UTC

    192 isn't that much either

    I'm not surprised, especially on CPAN. || and // can often be used interchangeably, and || is more backwards compatible.

Re^8: RFC: "assignary" operator ?= : (rareness)
by LanX (Saint) on Dec 10, 2019 at 11:58 UTC
    > Among 700.000 lines, 192 isn't that much either,

    Backwards compatibility?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      Backwards compatibility?

      Core modules need not to be written in a backaward compatible way in terms of operators they use. The core must be backward compatible wrt third party modules and existing code bases outside of itself.

      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
        I'd say most core modules are older than the // operator.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice