Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116634 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 78231 invoked from network); 13 Dec 2021 07:00:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Dec 2021 07:00:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 190BA1804DF for ; Mon, 13 Dec 2021 00:01: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.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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, 13 Dec 2021 00:01:53 -0800 (PST) Received: by mail-pj1-f49.google.com with SMTP id f18-20020a17090aa79200b001ad9cb23022so12634802pjq.4 for ; Mon, 13 Dec 2021 00:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=WVARxNLi8LNusFB/jv8ZihCzS1BQEdZ2u/1C4Dptt20=; b=XtAbqgAz0v3o7VghJcghIGDmtcIVAGRBGOdcwvRKptGajgmxeW4Wcx9za1eIRpCmGL BB3Fxol8RH3IVLBkZ9B91+pLir5WEIO2r1V5c2FgVWxzTlC6+4tInMhcZXqGkAF+LM7R OIWu3hA/KVLGEQvjx+IPnXHPS8DZxthA+wyz9OO0GY9hCTBQezngodErNJ/KLiPjZwzv dtxreTbCVMIgQK0ClweEjDD4Zo/MFPVClpzjIEQeul1kZX4r59ATbzrd0INKf/L3bvWw sbJ0EF/T+yUJwbztXAkm8PehiO5li+yJqC3Co611uMvbE90Zlw3ND+O+Qq84CKIx+RvG g/Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=WVARxNLi8LNusFB/jv8ZihCzS1BQEdZ2u/1C4Dptt20=; b=KZyM9Acb+xOW3TIAuInUNrTzyXKlOO1caUDpa1Rr/rGhkIKX43CD22w5snd1wrYu8G ai1dofUAAQQKxnRHBJ6iN0PEvFrq6SUb16Ph02B5NtT21t8iB+180w2pQWNt9pP5R0Ij gSt9qp8uOUhQNAZZ2B5Mkl53nYyW8EG6wbyfsWLCxEcQL2B4qPHMgAiDUW5ZPJF2XK8i P51KCspsubT42Sw8om5H4m+PLl/tA4zmWRG6zHJWahy9MCgNtU6/SyNkxGeVGb4TOWmT 1C1f1NJi08cfUNK9OAoee3K+yshKzbnF0G3+jA4N+m9CFGmwpyfSfCmzjHjjbJ+t2Xtv ELbQ== X-Gm-Message-State: AOAM533rQoKjpUAhnja+A6/PSaXDiUKcdaf4B2v7U9C+cBTnub6Z1w5o +TbIeclGoyQaQZUgOBgTDCvDTS38yjKC X-Google-Smtp-Source: ABdhPJwDeAyAat5SwDmvulPJJiHikOXoKGwVBUw/ID26lnxNDklKobRJ1b4l0W6qdv7ixtNnxFvKPw== X-Received: by 2002:a17:903:11cd:b0:143:d220:fddb with SMTP id q13-20020a17090311cd00b00143d220fddbmr93944529plh.5.1639382512156; Mon, 13 Dec 2021 00:01:52 -0800 (PST) Received: from [192.168.8.141] (c-73-189-171-247.hsd1.ca.comcast.net. [73.189.171.247]) by smtp.gmail.com with ESMTPSA id y130sm10980226pfg.202.2021.12.13.00.01.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Dec 2021 00:01:51 -0800 (PST) Message-ID: Date: Mon, 13 Dec 2021 00:01:50 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.3.2 Content-Language: en-US To: internals@lists.php.net References: <7126a5cb-fdaf-4e50-b8af-7d95965d1125@www.fastmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] User Defined Operator Overloads (v0.6) From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > 3. I am already aware of several people within internals that believe any > version of this feature will result in uncontrolled chaos in PHP codebases. > I think this is false, as I do not see that kind of uncontrolled chaos in > the languages which do have this feature. However I would think that > allowing arbitrary overloads would increase that proportion. Depends on how you define "uncontrolled chaos". I have encountered toolkits where the authors think it's cute to define "+" to mean something that has nothing to do with mathematical addition (go read the manual for an hour to figure what it actually does) or for += to mean something different than + and assignment. Some people even learn to love it, so far I haven't. > However, once a feature is added it is very difficult to change it. Not > only for backward compatibility reasons, but for the sheer inertia of the > massive impact that PHP has. I do not plan on ever proposing that arbitrary > symbol combinations be allowed for overloads myself. But I cannot possibly > know what internals might think of that possibility 10 years from now when > this feature has been in widespread usage for a long time. Using magic > methods makes it extremely difficult at *any* point in the future to allow > PHP developers the option of an overload for say +=+. What would such a That's awesome. The only thing worse than a toolkit author that thinks it's cute to play with "+" is the one that thinks it's cute to invent some random combination of special characters and assign it some meaning that of course is obvious to the author, but unfortunately that's the only person in existence to whom is it obvious. Some people enjoy the code being a puzzle that you need to untangle and make a sherlockian detective work to even begin to understand what is going on in this code. Other people have work to do. And again, what's the intuitive difference between operators +=+@-+ and ++--=!* ? Of course, of course I know, every feature can be abused. The difference here is that if it's hard to think about any use that wouldn't be an abuse. > That sounds far *less* maintainable to me. It seems more likely that even > if it were a desired feature 10 years from now, it would be something that > would be extremely difficult to implement, maintain, and pass. I must notice "if" carries a lot of load here. -- Stas Malyshev smalyshev@gmail.com