On 20/01/2023 18:43, G. P. B. wrote:
That's a strange hill to die on, most people would expect that those operators do indeed behave like Add1 and Sub1, and clearly you are not having any issue with making -- act like Sub1.
It isn't so strange, when you consider that an OS library like PhpSpreadsheet with over 100million installs makes extensive use of alpha and numeric increment (not alphanumeric); and I dearly wish that PHP had implemented the decrement operator for alpha strings as well, because that would have allowed me to simplify the codebase even further; so I would prefer if -- acted like a decrement for alpha strings, and not simply as a Sub1 for numerics.
The documentation page consistently uses the word Increment and Decrement, not Add 1 and Subtract 1.
Developers who read the documentation should be aware of the Perl convention when dealing with alphabetic strings, and should expect that behaviour. Alphanumeric strings are certainly more problematic, less well documented, and less well understood, and I'll agree that they're inconsistent in their behaviour.
Deprecating the Increment operator for strings will create extra work for me, will affect many of the users of my library, and I'm certain it will also have a performance impact on the library (replacing that operation with a more expensive function call for alpha increments, but still having the operation for numeric increments). So yes, I am willing to die on this hill because that deprecation will have a very direct and adverse affect on my work.
-- Mark Baker -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php