Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119340 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 27406 invoked from network); 19 Jan 2023 00:23:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Jan 2023 00:23:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A0705180504 for ; Wed, 18 Jan 2023 16:23:54 -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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,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 outbound5.mail.transip.nl (outbound5.mail.transip.nl [136.144.136.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 18 Jan 2023 16:23:53 -0800 (PST) Received: from submission15.mail.transip.nl (unknown [10.103.8.166]) by outbound5.mail.transip.nl (Postfix) with ESMTP id 4Ny3Jm2RFzzfQJt for ; Thu, 19 Jan 2023 01:23:52 +0100 (CET) Received: from [IPV6:2a02:a450:3eae:1:3c1a:2c3a:1b1:d24c] (2a02-a450-3eae-1-3c1a-2c3a-1b1-d24c.fixed6.kpn.net [IPv6:2a02:a450:3eae:1:3c1a:2c3a:1b1:d24c]) by submission15.mail.transip.nl (Postfix) with ESMTPA id 4Ny3Jh0s55z3wjK for ; Thu, 19 Jan 2023 01:23:48 +0100 (CET) Content-Type: multipart/alternative; boundary="------------suiELecv08GvKiZqNcgs9WIX" Message-ID: <768de46c-9ff2-eee2-24ab-e78e27ad167c@demon-angel.eu> Date: Thu, 19 Jan 2023 01:23:48 +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> <789af205-4582-66a9-694a-10e18b8b9f56@demon-angel.eu> <9d225219-4e31-b362-52a9-9a298a0a55ef@telia.com> In-Reply-To: X-Scanned-By: ClueGetter at submission15.mail.transip.nl DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=transip-a; d=demon-angel.eu; t=1674087828; h=from:subject:to: references:in-reply-to:date:mime-version:content-type; bh=zKjhicpSRerjYhaqK39tLGCNH/f8xOUmXX3q8EMhNm8=; b=bUQASyaEgIZcKirtE67rjJLnwf11nZJidZVBZYdpJBL/jE1FF5k+7y/kl0sm2Ov33iCaW8 T09LdAw4Fzk7wi1FNA7vNy6A+MdTTd7MK5djLxbra/TMnTggsRPA1QPdoKrAVpI7i5UNAu kLBIvbuHhnfJLbxG8c3ZXPdGqD/RV6aiT85pZ+kOrfA4CCMpV99L/EaK/c+FVpQ/nqF0A0 3U0sHPuEBRIB+M79pVxCOaKnX680WNvVVpCXjZnABWE5dZ0kK3/LDwWIvR5CWwWcsVbI7p LhD3zaoIGNtd7UX4PpBOSaqSRAop7R+cPlwJknH64CKon4V8cmxtx7cETEuWzA== 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) --------------suiELecv08GvKiZqNcgs9WIX Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 18/01/2023 21:25, G. P. B. wrote: >> I would like to start the discussion on the Path to Saner >> Increment/Decrement operators RFC: >> https://wiki.php.net/rfc/saner-inc-dec-operators >> >> The goal of this RFC is to reduce language complexity by making $v++ >> behave like $v += 1 and $v-- behave like $v -= 1; > If that is the goal, then I would agree with this RFC. > > However, changing the PERL string increment feature does not IMO fit > into that goal, and it also a useful*feature*. On that base I would > vote against this. And I suspect many others would as well. However, the ++ and -- are the "Increment" and "Decrement" operators, not the Add1 and Subtract1 operators; while they behave in that way when used with variables containing numeric values, they are special operators and not simply a syntactic sugar for +=1 and -=1. As long as their behaviour is consistent, and definition of what "Increment" and "Decrement" mean is clearly defined for different datatypes, then I feel that the PERL-style alpha string increment has enough valid use cases to justify itself. We might also discuss consistency of datatype changes when these operators are used. $a = PHP_INT_MAX; ++$a; or $a = '10'; ++$a; both change the datatype of $a; which isn't documented behaviour either. -- Mark Baker --------------suiELecv08GvKiZqNcgs9WIX--