Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70609 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55520 invoked from network); 12 Dec 2013 20:33:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2013 20:33:44 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 198.187.29.240 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 198.187.29.240 imap2-1.ox.registrar-servers.com Received: from [198.187.29.240] ([198.187.29.240:47498] helo=imap2-1.ox.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BF/13-32587-7AD1AA25 for ; Thu, 12 Dec 2013 15:33:44 -0500 Received: from [192.168.0.13] (unknown [94.13.99.191]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id D47F85A0079; Thu, 12 Dec 2013 15:33:37 -0500 (EST) Message-ID: <52AA1D9C.9010306@ajf.me> Date: Thu, 12 Dec 2013 20:33:32 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Adam Harvey CC: PHP internals References: <52AA1649.2090601@ajf.me> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PROPOSAL] Alphanumeric decrement From: ajf@ajf.me (Andrea Faulds) 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/