Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116630 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45681 invoked from network); 12 Dec 2021 18:09:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Dec 2021 18:09:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9923F180507 for ; Sun, 12 Dec 2021 11:10:37 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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-ua1-f42.google.com (mail-ua1-f42.google.com [209.85.222.42]) (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 ; Sun, 12 Dec 2021 11:10:37 -0800 (PST) Received: by mail-ua1-f42.google.com with SMTP id 30so25685125uag.13 for ; Sun, 12 Dec 2021 11:10:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IcF00n0t5m418n0pEelJwd9J4Dg570RAQb8UCe/B1No=; b=Nb0ncdG1WbNlPJ73+AORTPf9ItJBmk8Mdvg6oxBSKGaWBGncGLUKqryAu65rbXuPTJ 8dGhwkFFsm8oUl/2o8LsJQY4IpOCB9xd2cLgG0hlaloRBzzyCqfPm1M6T7kfR7x8qDUw JW7QPXLs7b8GEQOWAX7ZTl1GW4w1ThPcBgBjDjVD7/uIjoF5sahamzjHb1SpWrMSY7Nc dCc8HYWLzKukOcXYIN4E2QA3AHHWnhF1KlLeEnLgjyCGy2Ko/GuVrMjBr8W+HQH9M2ub nGmgkFHU2JY5TDMnvQK0afDEDln4/ELsCKyVwdrYch4ENRpGgla1TWr0CKU2HZ/mNaxQ rntQ== 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=IcF00n0t5m418n0pEelJwd9J4Dg570RAQb8UCe/B1No=; b=OQuQeUg6a7T9EQhMcmYgb1jSn7i7QwB9ICbBXX4i2TdnL/glGeTURCZGIWdA7GvezJ SKIS0tbD0AI4mxp7Z3aWxDzH5SDbEaSoLYwwqM7gXf7RYyCEm5EcjnOWawbVT1iUq7Zb U8Ho7URQ9iCbUK64/ksc5sZ8SE4/3cxqRlSAw1ZTp3kSoJDrqwOzTyDNMQHcDYkYaSqF Qy6vUVVUhDRixjE7LtGmA0urTTepfV74vE0ZYJ5okle7Py+I36+NWMRObMGn6tqZHfe8 vTnw2KgbF7wNrItsgcnH/0nf0u9L5rRWf0RJpU2ycbEC7AINqo8yJ7bflLQKSE+u+PiU ABsg== X-Gm-Message-State: AOAM533yLhA0n1602HHfjNG08ODGDjxHTP4A5uYNKKWFqzBaxRvdoIgu 2Tv3EQfgQvP0vvDZK0TDpDQvhP43ObdBT34HLvRsqw== X-Google-Smtp-Source: ABdhPJywep7aj+68ngotzOmaeCHWxLXJEsp9wuBnjyd+G18vkgn0p3k227i1DPNJTdd/4upf1Cu+TpYD77+1Lpmj+Nc= X-Received: by 2002:ab0:35e8:: with SMTP id w8mr37843713uau.31.1639336236353; Sun, 12 Dec 2021 11:10:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 12 Dec 2021 19:10:25 +0000 Message-ID: To: Jordan LeDoux Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] User Defined Operator Overloads (v0.6) From: Danack@basereality.com (Dan Ackroyd) On Sat, 11 Dec 2021 at 19:13, Jordan LeDoux wrote: > > I *think* that all of the things you mentioned will need similar > updates to work correctly with this RFC even if it was done > with plain old magic methods instead. No, that's not true. Codesniffer and all the other tools parse magic methods just fine. Stuff like the coverage notation for PHPUnit would understand `@covers BigNumber::__plus` just fine. The main piece of work each of them would need to do to support this RFC, if it was based on magic methods, is being able to understand that objects can work with operators: ``` $foo = new BigNumber(5); $foo + 5; // Check that BigNumber implements the magic method __plus ``` That is far less work than having to add stuff to parse a new way to declare functions. Jordan LeDoux wrote: > > Danack wrote: >> # "Non-Callable - Operand implementations cannot be called on an >> instance of an object the way normal methods can." >> I think this is just wrong, and makes the RFC unacceptable to me. > > First, you can still get the closure for the operator implementation > from Reflection if you really, really need it. Sorry, but I just find that a bizarre thing to suggest. Introducing a new type of function that can only be called in a particular way needs to have really strong reasons for that, not "oh you can still call it through reflection". I think you've taken the position that using the symbols are cool, and you're reasoning about how the RFC should operate from decision. I'm not sure I can make a reasonable argument against it that you would find persuasive, but to me it's adding a non-trivial amount of complexity, which tips the RFC from being acceptable, to not. cheers Dan Ack