Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119394 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38262 invoked from network); 23 Jan 2023 13:06:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Jan 2023 13:06:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DE4BC18037F for ; Mon, 23 Jan 2023 05:06:19 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (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 ; Mon, 23 Jan 2023 05:06:19 -0800 (PST) Received: by mail-pg1-f169.google.com with SMTP id s67so8899218pgs.3 for ; Mon, 23 Jan 2023 05:06:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IR9qod4melMjBTEtr6wnWgkfPxSW7UtlqfoAQ0uGYi0=; b=bX3+rwQvRlW1JOQx9JOPOQBKcNsOMD4Kn9FWZdznnIjBse6HVFYhG28+8ZEnvH4Z1T 0HoNQTh5ZP/e2qpZ68CP0gGTuuAteA3DQHoWSiGYv0cKLSLo63zuVWsgnLrAAQqQ21Te M9j2ZnYZ7xXpIFLAr2v+VwBsrtwBv9ocLlm3kBKCRGOzSPd2pNjSR0+WIB58zIDvIG8e 9uqJ1kVfjjRZtqLwZf7YL5JWCZFSby8pbUtbFVsVQg64RXqvligHlmIAx0hFdnr3ElDQ UxVHOhpTZQXQpEBQGjPGiQb+aCLGaPnh6vMwwS5xxt7kMVigzXb5IGaGpm2jwuBACAi7 1eKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IR9qod4melMjBTEtr6wnWgkfPxSW7UtlqfoAQ0uGYi0=; b=bjDFThOcwKmTQZc6YYoGlagwQnWUoF/lJLmpthAQKL1vhZDwJgd4xHIiszIahBw+TS hU7SOSQGx+gEVc07ZCLKuu8h5Y5CPy3S/qi9aPK+B3Hv+MonfT92WZpYfoLuZDj84+wC zFbXjxXUHnTz8sFGzEhH/UAs9Pp+q1ByvgiYDdn2mHZoRXGsZU3zkaOulNme2zcU/9fQ wwzBwhEucYvXyDH1W1hFYf+FXzomopH2Ajkv8ZjvioLtcy8WaRQdc+S1P1nbkJyjDup4 rO4oARBqbP+SK9oNlpiYXDxo80QKR/WSyUarfEGEDIQqbvcNviqBnqzrhxdeqLXvqhxd ZqMg== X-Gm-Message-State: AFqh2kq3yRdPSr91vE93NvPm0piX90dQiQtgmUbzDL41EUxSdOzqXsrl EYwFmvKcozXEohTSXgkORZbiwuFiXHGf7BQOOtZyOSooknc= X-Google-Smtp-Source: AMrXdXvolNQLIIBtfiasGn2oFvnQZ7hRtrAgmIfgzWHeQnKN/u6LzAEDAo1m9co89P5rhQk5ePiUV7avZ6KahUq+vaE= X-Received: by 2002:a62:4e8e:0:b0:586:4e66:eadd with SMTP id c136-20020a624e8e000000b005864e66eaddmr2570531pfb.71.1674479178299; Mon, 23 Jan 2023 05:06:18 -0800 (PST) MIME-Version: 1.0 References: <5FC8DBAF-8D78-4E94-A3B0-3BDED3A3E53C@craigfrancis.co.uk> <789af205-4582-66a9-694a-10e18b8b9f56@demon-angel.eu> <9d225219-4e31-b362-52a9-9a298a0a55ef@telia.com> <768de46c-9ff2-eee2-24ab-e78e27ad167c@demon-angel.eu> <828f1ec6-e8ff-01b2-dc0e-a6cf1dd16eb2@demon-angel.eu> In-Reply-To: <828f1ec6-e8ff-01b2-dc0e-a6cf1dd16eb2@demon-angel.eu> Date: Mon, 23 Jan 2023 13:06:07 +0000 Message-ID: To: Mark Baker Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000009b3e6905f2ee10e7" Subject: Re: [PHP-DEV] [RFC] Path to Saner Increment/Decrement operators From: george.banyard@gmail.com ("G. P. B.") --0000000000009b3e6905f2ee10e7 Content-Type: text/plain; charset="UTF-8" On Fri, 20 Jan 2023 at 18:28, Mark Baker wrote: > The documentation page consistently uses the word Increment and > Decrement, not Add 1 and Subtract 1. > > Developers who read the documentation should be aware of the Perl > convention when dealing with alphabetic strings, and should expect that > behaviour. Alphanumeric strings are certainly more problematic, less > well documented, and less well understood, and I'll agree that they're > inconsistent in their behaviour. > The PHP documentation has never been the source of truth about the PHP implementation, if it was dynamics properties should have been removed without any notice as until them being deprecated there was no documentation. So arguing *something* should behave a certain way because the docs are written in a certain way holds no value to me. The state of the PHP docs could certainly be improved, as it is blatantly lying at various core sections. However, the whole point of this RFC is to *remove* cognitive burden for developers, so they don't even need to be aware of this "feature" and not get surprised when it kicks in. Moreover, by your logic, you wouldn't care if we removed support for alphanumeric strings and only let the PERL increment kick in for purely alphabetical. While convenient for you, someone might actually use this feature on alphanumeric strings, and we're back to "why is my use case being removed while that other just as weird one remains". I even went initially for such a proposal (see previous revision [1]), however, I realized this provides minimal benefit as it doesn't reduce at all the cognitive burden or the overall design specification of the language. > Deprecating the Increment operator for strings will create extra work > for me, will affect many of the users of my library, and I'm certain it > will also have a performance impact on the library (replacing that > operation with a more expensive function call for alpha increments, but > still having the operation for numeric increments). So yes, I am willing > to die on this hill because that deprecation will have a very direct and > adverse affect on my work. > If the issue is about performance, it is possible to enhance the optimizer to inline those two functions (something the optimizer already attempts to do for userland functions [2]). The other aspect goes back to the typical conundrum: Do we think PHP is in decline? - If yes, then not doing breaking changes and catering to legacy projects is definitely the course of action to take. - If no, improving PHP for the next generation of developers and software, so that it is easier to learn and reason about, should be the course of action to take. As I personally think we are in the second situation, that's why I'm tackling this subject in this manner. It's the same belief that made us deprecate dynamic properties, convert warnings to Errors, etc. Now, if we are in the former case, then you are totally justified, and I probably should find another job as I see no point in not improving the overall language semantics. George P. Banyard [1] https://wiki.php.net/rfc/saner-inc-dec-operators?rev=1669977388 [2] See zend_try_inline_call() function --0000000000009b3e6905f2ee10e7--