Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70608 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53628 invoked from network); 12 Dec 2013 20:20:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2013 20:20:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.223.181 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.223.181 mail-ie0-f181.google.com Received: from [209.85.223.181] ([209.85.223.181:42252] helo=mail-ie0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6C/B2-32587-17A1AA25 for ; Thu, 12 Dec 2013 15:20:01 -0500 Received: by mail-ie0-f181.google.com with SMTP id e14so1380831iej.26 for ; Thu, 12 Dec 2013 12:19:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=6RL5Jpg3Rh14qpiNNOa7nsRqUK77C1eLgowm5V5JMT4=; b=Lon0XWfykpeQT3FNyEckR9mAuphLEYkgE5vSoyZQ6Ye/uN7eYiHL1GIN86iYuwuzv4 eIG91yNeRRWSI20Ve9tIaSZwsOBBbRlB7UM0QCu9dirwWOFk/paNdFpNwtYgcg7XzViT +P8jYv/OKrKF4g7qqESWMHyNTembMveFWuRdc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=6RL5Jpg3Rh14qpiNNOa7nsRqUK77C1eLgowm5V5JMT4=; b=cSyCmwuqXkMiyxkQObOolQ9WDJESY9W76Qqf8OZaWPZdfDOob0dmDOEiVLk8sJAEuq kx7D8z/+fd3xywR5BPJEyCzNXdiYVXc8f8NJLGOtjelR85UDHHzVtHJ99WEFgA8UZIWJ 7JlW+eIVXOwHXvJNWo3jmdFkpbnMAqYuFzHRviSLBi2sJ67mprCF6s/FdvffdZvW6zWz Y/zCyN7cQdQ5IYBpkMvM2X78eGGVkeB8KreG12FlwDgn15PDSqRPpWT68uOLCSqsjFM1 qoxlPFP3I50OOHwu1dn61n4lGRtr/ZfdjBscKHT2t/bo9Q0U97HjaKTU+NqLS9z0eiCa lnIg== X-Gm-Message-State: ALoCoQm9ixdggr0o7qJ5A1ZKfpcUHqmP5G5T7c3LNejoHBivt6kuR1c7o99oFunm7np3jkrXSwkZ X-Received: by 10.50.122.38 with SMTP id lp6mr33202258igb.30.1386879598229; Thu, 12 Dec 2013 12:19:58 -0800 (PST) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.42.206.208 with HTTP; Thu, 12 Dec 2013 12:19:37 -0800 (PST) In-Reply-To: <52AA1649.2090601@ajf.me> References: <52AA1649.2090601@ajf.me> Date: Thu, 12 Dec 2013 12:19:37 -0800 X-Google-Sender-Auth: 1k02JvFr9tiP1Y_KZFBMI9AffQA Message-ID: To: Andrea Faulds Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [PROPOSAL] Alphanumeric decrement From: aharvey@php.net (Adam Harvey) On 12 December 2013 12:02, Andrea Faulds wrote: > So I've written a patch which would change this. "aa" when decremented would > be "z", and "b" when decremented would be "a". It also handles decrementing > "a", which becomes "0". This creates an interesting new asymettry: {$a = > "a"; $a--; $a++;} will result in $a being integer 1. I think it's better > than the previous behaviour, though, which resulted in "b". 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?) > The diff is here: > https://github.com/TazeTSchnitzel/php-src/compare/php:PHP-5.6...AlphanumericDecrement > > My aim is to try and get this into PHP 5.6, if people are interested. > Thoughts? I haven't looked closely at the diff yet, but +1 on the idea. We've always documented that decrement doesn't work, so there shouldn't be a BC concern there. Adam