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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |