While I agree with your arguments that the current Perl 5 operator precedence could be improved, I don't feel it is appropriate to change operator precedence in a language as mature as Perl 5, with millions of lines of code in production use. That is, the (small) gain of your proposed change is not worth the considerable pain.

A new language, like Perl 6, is another matter. And I see that the Perl 6 folks agree with you; that is, Perl 6 is already using your proposed operator precedence for its Replication (x and xx) and Concatenation ~ operators.

By the way, notice that the current Perl 5 string multiply precedence is the same as Ruby and Python because they both use * as the string multiply operator. Ditto for string concatenation because Ruby and Python both use the + operator for that.

Though string multiply may be rarely used in general Perl coding, it is heavily used in golf ... so your proposed precedence change would certainly be welcomed by golfers. :) To illustrate, in The golf course looks great, my swing feels good, I like my chances (Part VI), a very rare example of Python out-golfing Perl and Ruby was given:

$"x(318%$_/9) Perl " "*(318%i/9) Ruby 318%i/9*" " Python
Python was shortest here because the string multiply operator is commutative in Python (only), allowing the parentheses to be removed. That said, the most common use of string multiply in golf is with a boolean expression, for example:
"Zaphod Beeblebrox"x($n!=42)
and your proposed precedence change wouldn't help there.


In reply to Re: Precedence design question...'x' & arith by eyepopslikeamosquito
in thread Precedence design question...'x' & arith by perl-diddler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.