Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116795 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 37659 invoked from network); 3 Jan 2022 20:08:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2022 20:08:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4F0C81804E3 for ; Mon, 3 Jan 2022 13:15:10 -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.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 3 Jan 2022 13:15:09 -0800 (PST) Received: by mail-lj1-f169.google.com with SMTP id r22so57490918ljk.11 for ; Mon, 03 Jan 2022 13:15:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eb6QRS6NCeV2SYL1U8vGrtA1wObqiiLWtK4lAN15dJU=; b=aM1sZ6xoWx8xjYEWnOXrTC9h2mTTyoBv2pN9DjCCZkwvSsTx0+EphNzGazcqeP6W2j r/gvNSuc0KZOrCR8C7IPYnBirroazPrh6+nbZYs7k5M2FpaTTTPRdNSLTeYBpPimmeE3 aCLhige6IXCfZyCxJhA0CfQJPP1qfZCAKqjx0KB+tQMCo1qRtfMpesmhZipjagvm5CCk eWgWi6QXhYrV2KtJwCLQMU8lvomZmkdY/9z4ib8v34e4qhfHPjX6wCtX+lWrRa977rPP ++UY4hQ992SeAcbNewWcHgA4zMdl8C1FuMSHzWTSL9BdaiQEqnaztzc39LC8CDxtEvHu ASjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eb6QRS6NCeV2SYL1U8vGrtA1wObqiiLWtK4lAN15dJU=; b=37HL8NAFQMiGMw7rfXizzwk4ue05Rnj7pmJBdrNflA/CMyKbCVTNYikXOvyHkJQSgI LxZ6Q+Lu/KmIYDBNRRr6oQ8NIppvE2kL0cGgOeb5OsWLhgVEmVx+mboiG71CyyZctFMi gqywny15XOShoEzcuXt41sGKzs5hWNEIrEt8G5E+y1CxC9k3rS320LE8+jl7k085y/dd FJjiJQAmZjpA9sVJXqaP+xxAnUwgbbbERPXfSnZtU1/4qEDzaT90e/odX0evzQqUMsXm dCCtiR9SifzYb20kYg78AVxr/Mrt24pdNQrKeOW7MAZnG6v6dOVkxUr/dpCawKi8y+3Q MuXA== X-Gm-Message-State: AOAM5318mlEkT9JhvXTBBHfYfCLXRDz4XTS7/DTWg3XYAdnkOCp/O1XM wXS46xVZDIy8oT/YgS26AhEU1OihSIyntUtPoePGccLz X-Google-Smtp-Source: ABdhPJxlXCiyiw91Dxi0TER1ChyCorBX0IiS+vuDF7l5jcjw5EKFjUHKyXP5SbEdCIKhqAVqSGtqi1OjfbeMDs8e1Zc= X-Received: by 2002:a2e:b4a6:: with SMTP id q6mr36921554ljm.7.1641244508286; Mon, 03 Jan 2022 13:15:08 -0800 (PST) MIME-Version: 1.0 References: <3225c921-9b26-d2e0-f76f-45fff6f5a12a@processus.org> <40a1e5fa-396d-d9ef-93ab-6fcfb5054092@processus.org> In-Reply-To: <40a1e5fa-396d-d9ef-93ab-6fcfb5054092@processus.org> Date: Mon, 3 Jan 2022 13:14:56 -0800 Message-ID: To: Pierre Cc: Larry Garfield , php internals Content-Type: multipart/alternative; boundary="000000000000e7f17405d4b4031b" Subject: Re: [PHP-DEV] [VOTE] User Defined Operator Overloads From: jordan.ledoux@gmail.com (Jordan LeDoux) --000000000000e7f17405d4b4031b Content-Type: text/plain; charset="UTF-8" On Mon, Jan 3, 2022 at 9:07 AM Pierre wrote: > I forgot to answer to that, specifically. I'd much more prefer to have > an explicit `equals(object $other): bool` (magic or not, really I do not > care) single method for equality only, that'd be great. In that sense, I > much preferred specific RFC about `__equalsTo()` or `__compareTo()` > alone that a huge generic operator overload RFC. I think both could > actually be separated, it wouldn't be that weird. > Based on the feedback so far, I am... concerned that doing so would leave the mathematical improvements out in the cold. It seems that a non-trivial number of voters do not see mathematics as a desirable use case on its own. There's not really anything preventing that part from being ripped out on its own, but the mathematical overloads add almost no complexity on their own to the patch. One of my main goals in contributing to PHP is to improve its usability and performance in mathematics. Using magic methods instead of the operator syntax would take perhaps 2 hours to implement, it's a fairly trivial change in the scope of the RFC. However, I have no plans to bring this back in time for 8.2 should it be declined with a magic method implementation. Fundamentally, there are many voters that seem to be more concerned about possible abuse that empirically does not exist in most languages which have this feature, instead of improvements to one of the most neglected domains PHP is used in. And that's the real crux: *most* (but not all) of the objections raised so far suggest a future that factually does not exist in the example languages we can look at which already have this feature. C++ is perhaps the one real example of widespread abuse, however there are *multiple* aspects of this RFC which *specifically* target and discourage that kind of abuse. (Explicit typing of parameters, non-optional support for implied operators, restrictions on the return types of the == and <=> operators, errors and exceptions being propagated immediately, etc.) Further, the operand is not passed by-reference in this implementation, which flatly excludes many of the worst possible abuses. I understand all of these objections, but I do not agree with them. Obviously. If I did, then I wouldn't bring this RFC to a vote. What I have proposed is the most restricted version of operator overloads in any language I researched, and that is still not enough for many voters, some of whom have flatly stated that there is no version of this feature they would ever vote for. If that is the kind of headwind against quite fundamental improvements to mathematics within the language, then all of my energy will be required to produce any improvement at all, and I cannot spend effort on things which are unrelated. Jordan --000000000000e7f17405d4b4031b--