Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115668 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 64709 invoked from network); 8 Aug 2021 16:22:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Aug 2021 16:22:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 35B391804C8 for ; Sun, 8 Aug 2021 09:52:09 -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=-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_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-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.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 ; Sun, 8 Aug 2021 09:52:08 -0700 (PDT) Received: by mail-wr1-f47.google.com with SMTP id h13so18126054wrp.1 for ; Sun, 08 Aug 2021 09:52:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=g5B20nfgwp4ePGQEJyWs6UNkW2ATrPCC9bPhqCUMpUg=; b=A7782fXgZFHkelPU+4uZUYR+wcihxFHNG1tVDHdFsO+WBUV0BXblSZnHTiOYYSojlq yjZpDHvYp/iEgnHn9bAnt0HUHZMAY/o9KjGvSN/l84z2sQmCdXXGo7xk/zvx1RD4Qiph jX7iP5Re5V4gTIiFWRC7Dhnt+au4M635akg+wsqgbIFeZ+ZHCJaTX0MxiQwg+IkDPQh2 mSXK7PC+XZfEcXEdU0avvJEGUCfmG9zrM3tJfdvJAotWxMgiJJl9X/0G2x462yaZBpz8 9kRamzov8GVQYC7eHHcUoDA6qiKQ5gxmeWcn6VOzdy7Co5l0zvmD1cvV/wCLvSBRnCxX lKcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=g5B20nfgwp4ePGQEJyWs6UNkW2ATrPCC9bPhqCUMpUg=; b=XZ4gjb2RFbpsxH4//wmgtlDsdEoqLCPsnBaPtVgpTU/IsaU2iSMMyiAxF5qj5l6ol1 5QKvlXxGbBVSw+/XRMu9f1dyBjiO3DPYvy0j97zJR09xTpXjbI1Bm4jYzUeAXniWsKT9 s6nsnff3nSyZUKMFpadKgceaCupQdvInGvCVf8VXUFcX3C3m/rm6EXsCyiNhC+cxZ1nX nowBCWOufd/xW1e6UCI/aenAbNLzxAHNm3RVO6OYuv20GwgTLFyFyjH72O0s9vgDDOgK lP+z0hunVoGKeykgEutFRHRzGYXA/UvpdRcJ625XgsnS3U6C/19nt96LNB2Qsdt5V1rW ib4w== X-Gm-Message-State: AOAM532yfJZJzte7eJePAtOw1BkG+uHiHykcYtABkY/Ik0lOivkqG0VF 1euU4WjP++UNacaVbB9hNzuseTzQuq8= X-Google-Smtp-Source: ABdhPJxoAQcypmTAycK0bJXPKELy5jBqTD0C7qHmZWOQm+BKAfa4q0z+HIW/UwYTUPAD2DNLpyPQIw== X-Received: by 2002:adf:f081:: with SMTP id n1mr21154615wro.235.1628441525960; Sun, 08 Aug 2021 09:52:05 -0700 (PDT) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id 140sm15755256wmb.43.2021.08.08.09.52.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 08 Aug 2021 09:52:05 -0700 (PDT) To: internals@lists.php.net References: <94696d46-c4e6-406a-b859-89144bff31bf@www.fastmail.com> <1ac66cec-239d-489c-ab96-304cc1e376fd@www.fastmail.com> Message-ID: Date: Sun, 8 Aug 2021 17:52:02 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <1ac66cec-239d-489c-ab96-304cc1e376fd@www.fastmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Subject: Re: [PHP-DEV] Revisiting Userland Operator Overloads From: rowan.collins@gmail.com (Rowan Tommins) On 08/08/2021 16:39, Larry Garfield wrote: > 1) Implementing an interface and stubbing out some methods is a lie. It's a lie the engine won't stop you from telling, but it's still a lie. If you only support addition and division, for instance (add to a collection and split a collection into several), then having a bunch of comparison methods that your object says you support but the program dies as soon as you use it is a lie, and a landmine waiting to happen. I find it odd, given your other comments, that you keep coming back to collection examples, which seem to me very much in the realm of re-defining the symbols to mean something different in a new domain. If "+" can mean "union" and "/" mean "partition", why not also let "<<" mean "append"? If we're saying we don't want "arbitrary weirdness", then discouraging "add" and "divide" on a collection feels like a feature, not a bug. > 2) As Jordan demonstrated, there are many even formally defined situations where some of the operators are explicitly meaningless. Yes, and as I demonstrated, there are situations where some of the operators are only meaningful for a subset of operands. Saying that a Money object is "Multipliable" would also be "a lie", since multiplying two Money objects together is a logic error, even though multiplying Money by a unit-less number is very useful. Regards, -- Rowan Tommins [IMSoP]