Modern algebra would say that although ++ is one-to-one, it is not onto. As such, it is not a permutation, since a permutation is defined as a one-to-one onto function from a set to itself.

-- OTOH (as it is currently defined) is theoretically a permutation over the set of all finite numbers, provided you run Perl on an architecture capable of storing and representing all numbers in that set. (In practice I am not aware of any such architecture, but nevermind.)

The logical conclusion is that if -- were made the inverse function of ++ it would no longer be one-to-one, because the inverse of a one-to-one function is onto and vice versa, but the inverse of a function that is not one-to-one is not onto and vice versa. Some people strongly prefer to avoid dealing with functions that are not one-to-one. Of course you could redefine the domain of -- so that it is one-to-one, but then you have a function on an apparently very arbitrary set (a set defined in terms of the range of ++ in fact), which could be considered "messy".

I don't know how much of this went into the decision, but I know that Larry knows some set theory, so it is entirely possible he considered this issue. It's also entirely possible that he just "felt" that applying the magic string extension to -- would be messy, without ennumerating all these points; sometimes people who design software for a living have a pretty good feel for which features would result in thorny issues. Sometimes they use the term "well-defined" to refer to a feature that can be implemented and meet most reasonable expectations. Applying the magic extension to -- would probably not be considered well-defined.


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

In reply to Re: $a++ allowed by $a-- is not ! why? by jonadab
in thread $a++ allowed by $a-- is not ! why? by abhishes

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.