Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117727 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82870 invoked from network); 13 May 2022 12:25:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 May 2022 12:25:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1A12318005C for ; Fri, 13 May 2022 07:05:14 -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.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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, 13 May 2022 07:05:13 -0700 (PDT) Received: by mail-wm1-f53.google.com with SMTP id k126so4867552wme.2 for ; Fri, 13 May 2022 07:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:user-agent:in-reply-to:references:message-id :mime-version:content-transfer-encoding; bh=BwCrXlDQpINgoYsQ2dWIESh+Bsmpe/hJzRIGnNxQhEk=; b=p62lCITuvnJWrNB0W+JmjTqQyutb9rLuAmxPLK96TuN+Ra1wMVnVvCOwXSgjWBTimA BNm7HryuhUIweImIqZCKd8/ILbbk/9V1WnS/IpMytUBhkHO+LTi8jaT6llrkQKUjKyDB IinceiJmFHA1I5GLh2xMb5N9Z11E0NfwE0cslv9C1GYe4Ens5xhpATKEZIjqs68T4V5/ e9oShFw06vn4+OulBDdBVwI3eXabOGBhrScKB7zXfPdxgqWrierje5qIup4sym/Ydip/ 5ylofcwRBradEes+wKYpEWP9/moYQQyf0W2ldv2OJvvLdg2yKCb8UkmXmDxWVz951iJh ARcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:user-agent:in-reply-to :references:message-id:mime-version:content-transfer-encoding; bh=BwCrXlDQpINgoYsQ2dWIESh+Bsmpe/hJzRIGnNxQhEk=; b=zxQ94uANwylsDBIbaAspa9cntX8NqShfwpFWkpjWOitOIOS6J7P64SZn9N0Ig/Jm+8 meBG1J8dDxR+gYwA7+4S5zCeXuVQY2YxICct03oV/+LlAtmQBV8Uah4m1E+g9pRUt8sU 0N7NNUgkW4PaNUI9r5d0VC3N3lTNBXXEbHo5v2b6zymixofYtObYcUaimT1b9rMAPHxU FD7fRQ//8gIRkGt4eJGuB8+bGzI9d/LmA0iSE4oXwRU2mqYYJY0isgT7ZvQgamvaUuNE yTnYnCIBAIABRl5lkytmeTMaOdt9iY/Zd8LV8/XJreAswIfbyNm+UJACMlcRH5fHN/Vk 2etg== X-Gm-Message-State: AOAM530H6CaYuvQ+gB4An67VFz5SSX9m/IbWfJFGz4WmT7Q2zvV5BZ8/ 1+tVF27aIU5z2Uaue56hwoGMluIaHFs= X-Google-Smtp-Source: ABdhPJyxsFKEOFP/Iqw6FSiPbwS54i5oULkrJ/Q73LFZNIJ3L5xtJ9SzfM1i6c5zaKSCvHRbleIUbA== X-Received: by 2002:a05:600c:3584:b0:394:5870:2c44 with SMTP id p4-20020a05600c358400b0039458702c44mr4894955wmq.4.1652450712306; Fri, 13 May 2022 07:05:12 -0700 (PDT) Received: from [127.0.0.1] (92.40.196.112.threembb.co.uk. [92.40.196.112]) by smtp.gmail.com with ESMTPSA id t6-20020a7bc3c6000000b003942a244f47sm5565489wmj.32.2022.05.13.07.05.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 May 2022 07:05:11 -0700 (PDT) Date: Fri, 13 May 2022 15:05:08 +0100 To: PHP internals User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] The future of objects and operators From: rowan.collins@gmail.com (Rowan Tommins) On 6 May 2022 23:16:37 BST, Jordan LeDoux wro= te: >I'm not sure at this point how voters think objects and operators should >work together into the future=2E I'd like to see if anyone is willing to = have >high-level discussion about the ideas, instead of picking at the >implementation or details of a particular RFC=2E Hi Jordan, I like Larry's "4 levels", but I've been thinking that there's some existi= ng functionality in PHP which takes a different direction: rather than over= loading *operators*, the language lets you overload *behaviour*=2E We have = magic methods like __get and __call, and interfaces like Iterator, Countabl= e, and ArrayAccess=2E Some hook into a particular function, or even operato= r, but they're generally described in terms of what they do, not what they = look like, if you see what I mean=2E From=20that point of view, overloading comparison and equality *behaviour* m= akes sense - it could affect not just the =3D=3D and <=3D> operators, but t= hings like in_array() and sort()=2E I think this distinction is more pronou= nced in PHP than some languages, because the standard library isn't "self-h= osted": a sort() call doesn't literally compile to a call to $a <=3D> $b It's less obvious how that applies to mathematical operators - should impl= ementing "addition" allow an object to be used with array_sum() perhaps? An= d what about deriving one operation from another, e=2Eg=2E $foo*3 running $= foo+$foo+$foo, or $foo**3 running $foo*$foo*$foo? I don't really have a conclusion here, I just wanted to throw it out there= as a different mental model to consider=2E Regards, --=20 Rowan Tommins [IMSoP]