Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72622 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28620 invoked from network); 15 Feb 2014 02:26:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2014 02:26:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 198.187.29.241 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 198.187.29.241 imap3-1.ox.registrar-servers.com Received: from [198.187.29.241] ([198.187.29.241:47515] helo=imap3-1.ox.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/03-34645-070DEF25 for ; Fri, 14 Feb 2014 21:26:56 -0500 Received: from localhost (localhost [127.0.0.1]) by oxmail.registrar-servers.com (Postfix) with ESMTP id 9FE202A0084; Fri, 14 Feb 2014 21:26:53 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap3.ox.registrar-servers.com Received: from oxmail.registrar-servers.com ([127.0.0.1]) by localhost (imap3.ox.registrar-servers.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uCROlHQ7EZiD; Fri, 14 Feb 2014 21:26:53 -0500 (EST) Received: from [192.168.0.200] (unknown [90.220.179.188]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id C45D62A006A; Fri, 14 Feb 2014 21:26:52 -0500 (EST) Message-ID: <52FED06B.4010601@ajf.me> Date: Sat, 15 Feb 2014 02:26:51 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Tjerk Meesters , PHP Internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [rfc] normalize increment and decrement operators From: ajf@ajf.me (Andrea Faulds) On 15/02/14 02:12, Tjerk Meesters wrote: > Following the earlier discussion of adding decrement for strings to > complement the existing alphanumeric increment feature, I've written a > proposal to normalize the behaviour across boolean and null values. > > https://wiki.php.net/rfc/normalize_inc_dec > > Based on some earlier comments, boolean and null values can be treated in > two distinct way, both of which are demonstrated in the rfc; I'm hoping > that before voting takes place we can eliminate one voting option > altogether. > > It also aims to deprecate string-based increments using `++`; instead, it > would introduce `str_inc()` and `str_dec()` as a regular function. > > Let me know your thoughts. I actually already wrote a patch for removing alphanumeric increment and decrement, if you're interested: https://github.com/TazeTSchnitzel/php-src/tree/AlphanumericIncrement Personally, I think the sanest solution is to increment number-looking strings as if they were numbers ("0" becomes 1), increment numbers (obviously), and throw a warning and do nothing for everything else. Though it would be best if the $a++ behaviour matches $a += 1 and $a = $a + 1. So, while I'd prefer the strict approach I just mentioned, we should actually make it function identically to the other ways of incrementing. -- Andrea Faulds http://ajf.me/