Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108335 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31849 invoked from network); 31 Jan 2020 17:44:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 31 Jan 2020 17:44:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D82B21804DB for ; Fri, 31 Jan 2020 07:55:31 -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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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-yw1-f52.google.com (mail-yw1-f52.google.com [209.85.161.52]) (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, 31 Jan 2020 07:55:31 -0800 (PST) Received: by mail-yw1-f52.google.com with SMTP id l22so5115430ywc.8 for ; Fri, 31 Jan 2020 07:55:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benramsey.com; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=Gc5PB8Weg5hXY16pRuNq4bD2jxs7OI5moKoXL0mpoNA=; b=KVZ3o3PFrxfz0RlJdsDO2l+DOOj1AsxiQriI4Mq6wVENd0q0s0OnfOHjNFMak+OHhS yP4iEknw08If+dGSDCZlW2nSkPNez9NVK9d7Aoj2BPhJuPUXWBKoei7sIN2Nk+b2wmUi /tKOJwNMDN903QHafFLAO7090Xt9+xsLH7vQimun+HN5RELhQiH4ffXyuLgywx0StuZ8 AMZ2gDku4LNFYL4JORFQGshnxgDuBJ0PLdTzaj62RAQAwUKfXXzCZX5VQBpJMBWTNuPv P1x4OxZdvJhR59IUUh0HGas4kp2mkponCrwmQwha3kTRdYbhPnueA558DR+6no2o+Moe hAHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=Gc5PB8Weg5hXY16pRuNq4bD2jxs7OI5moKoXL0mpoNA=; b=fbDCC5W9uyNzwMMpYalmaZDbG6hX2C75oFIoVP/EzOnRThGT6J8CZ/kaE6kcLeX15z puMDFlgZf98+GuFe0XuFfVoKfk13a/XgOZPjPPJY1H+CwsF7fOXDMl865EN4nqD6jPVY wo6ZEOkgpsHHB860AIks1IAzC5Kk2BdLywqtwzHKPVDPGd61wIe+p1QZxtFH//XsC4hC 9mOBH2W3i2EXol9S2yd+ok0rYPie6KhJ78UjV/tyBI9AbDUDv5uuckLv8kp+o+wbqxYt 1d/Dn/P9arpDYA11Dm0s5YGmrP1Y8zENw/6bDUmU5KbZV53APf8pXyUj1W1PwPGxT4R0 jaXA== X-Gm-Message-State: APjAAAXvDYOBzZ9HrxNaYD2quchRWq7tHGam/zM86qKge1s4Pa4AfBtp vuXt2tq1DP2RyazXArB9DHRdmA== X-Google-Smtp-Source: APXvYqyoShLo0jBVMHIUg1G7QTxkJ6nLuV14zXUXA2rkJlUD9UixfbjQJT3+xPvYG3C9nsEdkVnFQQ== X-Received: by 2002:a81:4fd5:: with SMTP id d204mr8704090ywb.232.1580486130476; Fri, 31 Jan 2020 07:55:30 -0800 (PST) Received: from [10.10.42.56] (h96-61-170-50.lvrgtn.dsl.dynamic.tds.net. [96.61.170.50]) by smtp.gmail.com with ESMTPSA id l74sm4227481ywc.45.2020.01.31.07.55.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jan 2020 07:55:29 -0800 (PST) Message-ID: Content-Type: multipart/signed; boundary="Apple-Mail=_90B25062-39D5-4C3E-99EB-F7015A773DC0"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Date: Fri, 31 Jan 2020 09:55:28 -0600 In-Reply-To: <7c915ed1-adcb-473d-a975-acfdbf7b1e33@www.fastmail.com> Cc: php internals To: Larry Garfield References: <00ea01d5d630$b18d4f20$14a7ed60$@gmx.de> <001f01d5d7b3$68c18b10$3a44a130$@gmx.de> <7c915ed1-adcb-473d-a975-acfdbf7b1e33@www.fastmail.com> X-Mailer: Apple Mail (2.3608.60.0.2.5) Subject: Re: [PHP-DEV] Operator overloading for userspace objects From: ben@benramsey.com (Ben Ramsey) --Apple-Mail=_90B25062-39D5-4C3E-99EB-F7015A773DC0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > Also, I want to reiterate: Any of these operations MUST be designed to = return a new value, never modify in place. These operators only make = sense on value objects, not service objects, and value objects should be = immutable. I completely agree. This was the gist of my earlier comments. Maybe we should resurrect discussion of the immutable classes and = properties RFC: https://wiki.php.net/rfc/immutability If we add the ability to specify immutability, then we can enforce in = the engine that the left and right operands must be immutable. For example: public function __add(immutable $left, immutable $right); Cheers, Ben --Apple-Mail=_90B25062-39D5-4C3E-99EB-F7015A773DC0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iHUEAREIAB0WIQToXQMR3fpbrPOmEOewLZeYnIwHGwUCXjRN8AAKCRCwLZeYnIwH G8G5AP9THj2Y28feSqr3aS5xU2t8NXWokdPoiJC2weC+QN58CwD/SqJA0wCU1rxT 9IK4M9GHpoLFe0yXlxsexlZ4f/UUN60= =RcQ2 -----END PGP SIGNATURE----- --Apple-Mail=_90B25062-39D5-4C3E-99EB-F7015A773DC0--