Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121416 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 8626 invoked from network); 18 Oct 2023 17:43:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Oct 2023 17:43:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 815D1180507 for ; Wed, 18 Oct 2023 10:43:00 -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.1 required=5.0 tests=BAYES_00,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, 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-vs1-f48.google.com (mail-vs1-f48.google.com [209.85.217.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 18 Oct 2023 10:43:00 -0700 (PDT) Received: by mail-vs1-f48.google.com with SMTP id ada2fe7eead31-452811f2731so635602137.1 for ; Wed, 18 Oct 2023 10:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697650979; x=1698255779; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=P3veIJ9H9HuRd/nI2CO8ixujYm2Q5/RpFjCnp6IGh9c=; b=IV/Dsj2B1rtfAIvNkWa+li4FsA1kU9BIiisvb88rvIIBikrKa7b8BNBivVXeAckC3+ d8GbAG3qKWuljFDCcMyP2D63sKuIFlTwRYg5Qq900LV8dCj+/NexzimfhQcrksbOZDih RUzyJ8YICs2R+v7/2yzUQi3ZFF7ODumpliOAXH6rz1ZMg/BHE0yG9C+HcWASADSLxpCx IQzYjeHw8/cvwfJn8QYYoWhw0AirpCF0kjcn2z8WNtoHPHnBs4hNNlHZfEmuqilYQo2A Xs8vsoM/XkzGc0iQWy3eRjUln0ewhN1lCRluiOOvFfv3SLrbmA/Rd11V9JoNFFrnihNK ePGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697650979; x=1698255779; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=P3veIJ9H9HuRd/nI2CO8ixujYm2Q5/RpFjCnp6IGh9c=; b=hn+NAaEspvSI61/lFq0h6ErhANbNmXGgkNeMWWy4GKelgJzaNY9VTRaZluv9zA23qJ WP4EAwAbeoxMH8BSwPA3v7VFe8JC/JX7RFoP4kdEDpVgHqBBnvlOvXbJLCJ8CAlHKEMU Ca37IWJ5kT925WNCETfOhFZR9m5D794lqjatcsRG3y2HSHMhAUsJhRosgV0TcKAFv7DE H2Ksq2LqwLU2cjn6C3PpNw10x8i5BZzjD6ELUil1RXJ8tiyJnzVVRd101LTwDRD7HLI4 by57n2zoJ9tPBsxc7aqAXn4qO/vJUp/0UWwrSA3vwzMQ0eC5BMAz8Yc4xy/Vj93mbDpD f0QA== X-Gm-Message-State: AOJu0YwF721ZS80n1uH3wI+rJneDUBWPXfmOvehz1+KsV6ztEaHZy/w2 W1nvPoL64gUXKlih6GlwCQcuZJBSDKf3ej5iU1WXwt4Zo08= X-Google-Smtp-Source: AGHT+IHDcd/DB32YPS3qx3JDW/9ebAJ/Vdx0iraKKfBei3DsMpQyhe++nBKblGn99jsi1BB7I8IOg1y0QyNY2bNH98g= X-Received: by 2002:a67:f842:0:b0:457:dabf:89c4 with SMTP id b2-20020a67f842000000b00457dabf89c4mr4544023vsp.3.1697650979056; Wed, 18 Oct 2023 10:42:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 18 Oct 2023 14:42:22 -0300 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000008f35230608012b94" Subject: Re: [PHP-DEV] Custom object equality From: deleugyn@gmail.com (Deleu) --0000000000008f35230608012b94 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Oct 18, 2023 at 2:05=E2=80=AFPM Christian Schneider wrote: > Am 18.10.2023 um 18:42 schrieb Larry Garfield : > > So the real question is: Would anyone who voted No on operator > overloading before vote Yes on it if it used ~=3D, ~>, ~+, etc. instead? > > I confess that I'm not a fan of operator overloading for a language like > PHP but introducing new operators on top of making them overloadable seem= s > a bad idea. Operators have the problem of being hard to look up and > prefixing them with ~ feels like the worst of both worlds. > > Regards, > - Chris > To add on to this, the proposal side-steps a potential BC break issue while introducing a collection of problems for libraries using PHP Tokens, Static Analysers, IDEs and more importantly the ability to grep your codebase looking for `=3D=3D`. From what I understood about the BC break concern, it's the fact that IF: - Existing code is comparing objects (relying on potentially non-deterministic behavior?) - PHP introduces operator overload - A library releases a new major version implementing operator overload - Existing code breaks Sounds to me that this is more between Library authors and Library users. Yes, PHP would be opening the door for potential BC breaks, but the stability of Composer packages and the adoption of Semantic Versioning throughout the industry makes this look like PHP is trying to protect grown, trained, mentally stable adults from running with knives. On Wed, Oct 18, 2023 at 1:43=E2=80=AFPM Larry Garfield wrote: > Honestly I'm still on team operator-override. *Most* major languages hav= e > operator overloading, and it doesn't seem to cause a problem. (According > to my research, C++, Kotlin, Swift, Rust, C#, Haskell, Python, and Ruby a= ll > have operator overloading. Go, TypeScript, PHP, and Javascript do not. > Java has comparison-only overloading so it's in the middle.) Most of the > "it causes so many problems" arguments are, from what I can tell, greatly > over-exaggerated. > > ---Larry Garfield > To argue against myself, I think Larry has a killer point in the language comparison. I think it's fair to say PHP is the weird one out for not having Operator Overload when even Python and Ruby (languages more similar to PHP than Kotlin or Rust) have them. Ultimately, if voters think it's best to overload `~=3D` instead of `=3D=3D= `, I think we bite the bullet and deal with the consequences. Even though I have every reason not to want `~=3D`, PHP deserves method overloading unless fol= ks can show facts as to why nearly every other major programming language is wrong or why they can have it and we can't. --=20 Marco Deleu --0000000000008f35230608012b94--