Re: [PROPOSAL] Alphanumeric decrement
| From: | Andrea Faulds | Date: | Thu, 12 Dec 2013 20:33:32 +0000 |
| Subject: | Re: [PROPOSAL] Alphanumeric decrement | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70609@lists.php.net to get a copy of this message | ||
On 12/12/13 20:19, Adam Harvey wrote:
I wonder if we'd want to warn when 'a' decrements to 0, since it's a somewhat unintuitive behaviour. (Also, since Perl will decrement 'a' to -1 and Perl was the original inspiration, do we want to decrement to -1 as well for consistency?)Ooh, I didn't know about Perl's -1 behaviour. That might be a better idea, since "z" becoming "aa" suggests that "a" is functions more like 0 here than 1. That, or the warning you suggest. Also, I forgot to mention in my original post, but there is another thing changed by this patch. At present, when decrementing a string, it is treated as an integer zero if it is empty. This patch also removes that check. This brings incrementing into line with decrementing. "" would increment to "1" and decrement to "-1", while at present it decrements to -1 (the integer). -- Andrea Faulds http://ajf.me/