Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71403 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11636 invoked from network); 22 Jan 2014 10:38:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jan 2014 10:38:54 -0000 Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.171 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.171 mail-qc0-f171.google.com Received: from [209.85.216.171] ([209.85.216.171:64427] helo=mail-qc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/C2-28690-CBF9FD25 for ; Wed, 22 Jan 2014 05:38:53 -0500 Received: by mail-qc0-f171.google.com with SMTP id n7so213433qcx.2 for ; Wed, 22 Jan 2014 02:38:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Rinb1ZzW8wPCg6vcMvdnkA2OZxaIPzbZajlAvyFmBLE=; b=hqnn62+u/TKiSuGF0Q1U7BphmbSClDhW0LWQB8E8ZmFWCgOVjzhnBecrGyumyzwvCw sgZc9i2Qqk3IzwoBaFXCwrKlVYtmOVu1SRdj3xD1Iz8QdSo+TcqZXKdnp9ryD6pn86nY 9ZN1P6AP0rCx+7+J0z8RfjXDOO0pVdpyiX/VN2DPq6AQmfrlRTQWNZvN4QPGb4Qpm1NN juy/wdNa66kkCb7bS5oIQh2p1Dkbe/E0zSjyApHV2WgXvSNBQ8S8OCWZjzkWWS5Uk4tF r/IZzoLagcckt813a7abLfdKqIuIYTQcOuHDfozKsDato4PfAld38HmwP/kQnQHEKzzA +5ZA== MIME-Version: 1.0 X-Received: by 10.140.83.112 with SMTP id i103mr967147qgd.100.1390387130172; Wed, 22 Jan 2014 02:38:50 -0800 (PST) Sender: are.you.winning@gmail.com Received: by 10.229.240.193 with HTTP; Wed, 22 Jan 2014 02:38:50 -0800 (PST) In-Reply-To: References: <52DDBAE5.2010803@ajf.me> <52DED5B5.9050905@ajf.me> Date: Wed, 22 Jan 2014 10:38:50 +0000 X-Google-Sender-Auth: 8OrzFP2ZV9VKQit-A3Fz70Lb3go Message-ID: To: Lars Strojny Cc: Andrea Faulds , Yasuo Ohgaki , PHP internals Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE] [RFC] Alphanumeric Decrement From: daverandom@php.net (Chris Wright) On 21 January 2014 20:47, Lars Strojny wrote: > I would rather introduce a deprecation warning for decrementing (and > incrementing) alphanumeric strings. It=92s just very bad behaviour and us= ing > chr() and ord() is not that hard :) Agreed that the *current* behaviour is very bad and not hugely useful. Being able to increment and decrement "strings" is, however, often useful behaviour when dealing with binary data, and chr()/ord() can be expensive in this scenario. I would like to have something closer to C's behaviour, where (given that in PHP a string is essentially just a char*) I can access a character in a string by index (returns a string) and manipulate it arithmetically - so inc/dec would alter the byte value by 1, over the full range 0-255. If this were the case, I would expect an inc/dec operation on a string >1 character to apply the operation to the first character in the string, and operating on an empty string would produce an E_NOTICE. I would hate to see a deprecation warning issued now if it's possible the behaviour could be made more sensible in the future and "undeprecated". Obviously this kind of BC-break would be for a new major version, I'm not suggesting this is done immediately. For the record, this also sums up why I have voted "no" on the current RFC - I don't want to introduce more counter-intuitive behaviour when there is a much more intuitive (and useful) alternative. Thanks, Chris