Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115648 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 98965 invoked from network); 6 Aug 2021 16:04:32 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Aug 2021 16:04:32 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D14F0180507 for ; Fri, 6 Aug 2021 09:34:03 -0700 (PDT) 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.6 required=5.0 tests=BAYES_50,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-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 ; Fri, 6 Aug 2021 09:34:03 -0700 (PDT) Received: by mail-lf1-f47.google.com with SMTP id b6so2711170lff.10 for ; Fri, 06 Aug 2021 09:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=YHZ4spanHZzG+8tJBU6Bzf88TQnqu+qqo6n3ft29uAU=; b=s+DBfUMzcCm6KNTlJHZ0HivNa1pIrJT7vUJqxEsarABOwNPW+YXLSEGkqts6kBoFsI kkpu/pkKEKUBV7WoEYTkAnolRxfevEZApTd05Hu6s91C2N2C6THDiGDqK6PDHnQi31qT 7pmAZF5JI8S9yJIV5b4N+TSPcb7OY89KVSJtqUnEQd+F4j6rnuM+DTZHgiU/a9fwyYHV SuRxkbSyWyJFIjf6uut57ENM7J+T2/ZfnSpEXfM1fZiqMr7bNhDgZk3iqVJPh2foiAim rhvafSMGJ53S+SxSMXF3jQBMtqXL0w+SpAWqgtuM1ztJTKmmvAIFzl9Ct6Ycf0fYAKNz /ybg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=YHZ4spanHZzG+8tJBU6Bzf88TQnqu+qqo6n3ft29uAU=; b=HDbpc9VF6rWjIY0gcrVGiXYAWEBXVBDglT26LleUa+TiAfre6nBKZQBQJY1M4ypUdx ubfWMjsdumN8f/VCxpPsAumtf6WkHScQY1yHLsyAtGJ7hGUglmkjS76ivnUEzLLzaP69 WJA+zPYFfHFuV1P0yF3Ek1coEbxq2NN/gDcb5Eqmno1wQzVNAwXGTY7ZnJasQtH1t+5y +W5Lfk0rsS3nEmSgTalEga5W9AGU76k/nD5giNFWzlVYASNhxImSq6acoFEuMCtE47a5 WrlwjSEL9WG3yM3Lg9yyG4NdgD+iQDaB/CXskLDphuB3DNT99cbi7lRbgHrwE0GeP/8T byyg== X-Gm-Message-State: AOAM532mxV96RaUDzC3ooOU/0SEjcEj0mixAKvDSCRoH4PiPkppMPSA/ AjhhnX5kZ4qyz/+LmN9oBtbCQ8hYheLPxELLm36a4hpLzQo= X-Google-Smtp-Source: ABdhPJzHvrSwPSDTtmBY9B+R4lQLatwVrgzY8Ei6xh0J+8sffyA5fu98HSaYWDYttD3ZBcLpVGhbQE9dmf+qpJhFi5A= X-Received: by 2002:ac2:5471:: with SMTP id e17mr7948938lfn.216.1628267638587; Fri, 06 Aug 2021 09:33:58 -0700 (PDT) MIME-Version: 1.0 Date: Fri, 6 Aug 2021 09:34:02 -0700 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000003286f605c8e69a38" Subject: Revisiting Userland Operator Overloads From: jordan.ledoux@gmail.com (Jordan LeDoux) --0000000000003286f605c8e69a38 Content-Type: text/plain; charset="UTF-8" Hey all, I contacted Jan a few days ago to ask if they were going to try again for their RFC, but I wanted to get a quick temperature check on this. I would like to work on this RFC for 8.2, and after going through previous discussions on the topic, I feel like the right place to start is to limit the RFC to only the mathematical operators at first. Based on previous comments, I was considering working from Jan's previous implementation with these basic changes: 1. The only supported operators in the RFC will be the mathematical operators: (+, -, /, *, **, %) 2. The RFC would also provide an interface, (something like MathObjectInterface), that has all the magic methods in it. 3. The do_operation would be changed to check for the interface being implemented instead of the specific method. All of these operators belong to the same "group" of changes, and (broadly) any object that is valid to override for one of them should be valid to override for any of them. NOTE: There are edge cases of this statement certainly. This would help address some of the concerns that were expressed about misuse of things like the + operator to add things to a cache. It would more explicitly take a position on how these operators should be used in userland code to keep them more consistent with the behavior of these operators in normal PHP code. This would be my first contribution and my first RFC, so I wanted to get some very broad feedback on this before diving in. It would suggest that future sets of operators could come with their own interfaces to also attempt to guarantee an all-or-nothing approach in userland code, (BitwiseObjectInterface, ComparableObjectInterface, LogicalObjectInterface, etc.). Though decisions on any of those operators or their implementations would be left as future scope. Jordan --0000000000003286f605c8e69a38--