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


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

So, it looks like there are plenty of use cases
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. If anything I think you've shown that this is a very rare use case and hardly justifies its addition to core.

Dave.

Replies are listed 'Best First'.
Re^7: RFC: "assignary" operator ?= :
by LanX (Saint) on Dec 09, 2019 at 23:49 UTC
    > you've shown that this is a very rare use case

    Plus many of these use cases are dubious and merit a new variable name for the sake of clarity.

    I'm a strong proponent of orthogonality, but I strongly doubt the costs of implementing this will ever pay off at this stage of language design.

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

Re^7: RFC: "assignary" operator ?= : (rareness)
by shmem (Chancellor) on Dec 10, 2019 at 11:19 UTC
    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'

      192 isn't that much either

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

      > 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'