Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119297 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 77458 invoked from network); 17 Jan 2023 18:28:29 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jan 2023 18:28:29 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 81D56180548 for ; Tue, 17 Jan 2023 10:28:26 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS20857 136.144.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from outbound6.mail.transip.nl (outbound6.mail.transip.nl [136.144.136.128]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 17 Jan 2023 10:28:25 -0800 (PST) Received: from submission10.mail.transip.nl (unknown [10.103.8.161]) by outbound6.mail.transip.nl (Postfix) with ESMTP id 4NxHT20Mw8zwLK8H for ; Tue, 17 Jan 2023 19:28:22 +0100 (CET) Received: from [IPV6:2a02:a450:3eae:1:e991:615c:5215:f6a4] (2a02-a450-3eae-1-e991-615c-5215-f6a4.fixed6.kpn.net [IPv6:2a02:a450:3eae:1:e991:615c:5215:f6a4]) by submission10.mail.transip.nl (Postfix) with ESMTPA id 4NxHSx3vKzz1gwwL for ; Tue, 17 Jan 2023 19:28:17 +0100 (CET) Message-ID: <789af205-4582-66a9-694a-10e18b8b9f56@demon-angel.eu> Date: Tue, 17 Jan 2023 19:28:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: nl To: internals@lists.php.net References: <5FC8DBAF-8D78-4E94-A3B0-3BDED3A3E53C@craigfrancis.co.uk> In-Reply-To: <5FC8DBAF-8D78-4E94-A3B0-3BDED3A3E53C@craigfrancis.co.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: ClueGetter at submission10.mail.transip.nl DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=transip-a; d=demon-angel.eu; t=1673980097; h=from:subject:to: references:in-reply-to:date:mime-version:content-type; bh=r+AEqeOSeSs6gWFQ4c8RGDst79Jh2Os5ZJFuqwIITK8=; b=HpghBDl7lYd7KWO4Q+QtVXTwQOBpOf2AlsfmgZGuCAy5B7gW0zHoOyWPt5B0BcsZ0oGIYS 9k7X1VN+Zc3HDtB/h4QEgtCz0Z+iPOJr+wwX6/3sLa3N16QckpsXBrdzcqyjPsUh9Qtjmb NgptwHJA5ScFV89YZYq7hD2EGb/6JgzEsxEpNt7BjyUUTOu5TzKISGx0OmFx1S2L0KDSQh +LYFzRvwY8GG9prf6R0HobIEHO6Vbct6ucrtTolswNLgv/eumRdlDTmHUI4ak5HRYQG0G2 BnYTbAjJOUfNx+0oDC80Xa/B71AU2j+inFUacN3lIqdsV9UQO+swIXmFbvEO5A== X-Report-Abuse-To: abuse@transip.nl Subject: Re: [PHP-DEV] [RFC] Path to Saner Increment/Decrement operators From: mark@demon-angel.eu (Mark Baker) On 17/01/2023 17:28, Craig Francis wrote: > I've seen this used a few times, e.g. starting with a numerical value (Passport number, NHS number, Social Security Number, Date of Birth 20230117), and the developer simply appends an incrementing letter on the end to get a unique reference; e.g. a person having multiple assessments... especially if it's more than 26 (A-Z), and you need to move to multiple letters, which `chr(90 + 1)` cannot help you with. Being able to increment alpha strings is incredibly useful when working with Excel spreadsheets (as I do on a daily basis), because the column Ids match this pattern; and I would hate to see this deprecated. Having to replicate that logic for traversing column Ids in userland code would be inconvenient (to say the least), would affect many of the users of my libraries, and would have a performance impact on my libraries. If anything, I'd rather like to see the decrement operator work with alpha strings as well for more consistency. I don't have the karma for a vote; but if I did then it would be a "No" for this alone, because I can see the problems that it will cause me and the users of my libraries. > That said, I appreciate that incrementing some strings can be a bit unusual (e.g. "A9" to "B0", vs "A 9" to "A 0"). Agreed. While incrementing works in a very logical manner with mixed alphanumeric strings, it's not well documented behaviour, and most developers take a long time before they understand what it's actually doing. While there might be use cases for incrementing alphanumerics, I suspect that it would be better implemented in the business logic of an application, because the component parts of that string are likely to have business meaning; and also to provide better code readability. -- Mark Baker