On Thu, 27 Jan 2011, Ed Avis wrote: > > No, not at all. I don't suggest any change to the existing semantics of +, > except that it should become side-effect-free, that is, whether you evaluate > ($b + 0) or do not evaluate that expression should have no effect on later uses > of $b. (Provided $b is just a plain scalar and not tied or an object, etc.) I would agree with this (caching converted representations should not be detectable at the language level). Unfortunately some operations are *documented* to behave otherwise: | The auto-increment operator has a little extra builtin magic to | it. If you increment a variable that is numeric, or that has | ever been used in a numeric context, you get a normal increment. | If, however, the variable has been used in only string contexts | since it was set, and has a value that is not the empty string | and matches the pattern "/^[a-zA-Z]*[0-9]*\z/", the increment is | done as a string, preserving each character within its range, | with carry: (From perlop.pod; note the phrase "used in a numeric context") Personally I consider these design mistakes, but I also don't think we can undo them anymore either. Just some of the warts we have to live with. Cheers, -JanThread Previous | Thread Next