Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102373 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82607 invoked from network); 22 Jun 2018 17:56:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jun 2018 17:56:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=rudolf.theunissen@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rtheunissen@php.net; sender-id=unknown Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.46 as permitted sender) X-PHP-List-Original-Sender: rudolf.theunissen@gmail.com X-Host-Fingerprint: 209.85.213.46 mail-vk0-f46.google.com Received: from [209.85.213.46] ([209.85.213.46:39408] helo=mail-vk0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C6/10-32156-9383D2B5 for ; Fri, 22 Jun 2018 13:56:09 -0400 Received: by mail-vk0-f46.google.com with SMTP id r83-v6so4388939vkf.6 for ; Fri, 22 Jun 2018 10:56:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=ZQj06rK12FOBE/bYjIcaJm6n9XBPsSynvVrTQyfr9Yw=; b=S6dJYHkncB0UAwLVGIHixDE6o5hxAqK+a3MKvqolPkP/typ/B9F+qsW3dL1PcgRSwm OJ61enU5RYNl1MKP4wfp7Io2LZtYHfZ+AcHp2z5p4rVues3KTe/jz6dsiGXZT8NZvuIj Nkl3TSOqKAGcEnC5XCu0zZlkbCLgPGVEJ5ikmPQvrqKqZJfbQV1eaIDET72XHofUb4KH XrPkMCxDHAbufgboHh/atkWeGvD+eafSlHA8+HT3LIhBDmj3v+GANcm0XtLsKyLgSvlR 8WmHztYExGTxVjFllGZxiijol/ncvqGiTvaY4v/TGFDIlH/hldMGuuf3NjshPJjenI1n bYKA== X-Gm-Message-State: APt69E3nxeVhh7iGjPmVWBBw01pUqQB1bFIeNOJ6UAe3gBxkKiY3j1iY ZBACyyIqA319Oj6ExEjfBXulqSpF X-Google-Smtp-Source: ADUXVKKu/nMMfgHZ+t2qKjZni2253LlxPTupT1+h73xg47cfQ2W5oNAcqnoFDtGScnQry3sRKUw1zg== X-Received: by 2002:a1f:f2cb:: with SMTP id q194-v6mr1569175vkh.39.1529690167050; Fri, 22 Jun 2018 10:56:07 -0700 (PDT) Received: from mail-vk0-f48.google.com (mail-vk0-f48.google.com. [209.85.213.48]) by smtp.gmail.com with ESMTPSA id z34-v6sm2224643uab.14.2018.06.22.10.56.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Jun 2018 10:56:06 -0700 (PDT) Received: by mail-vk0-f48.google.com with SMTP id b77-v6so4399979vkb.5 for ; Fri, 22 Jun 2018 10:56:06 -0700 (PDT) X-Received: by 2002:a1f:e0c3:: with SMTP id x186-v6mr1579430vkg.105.1529690166591; Fri, 22 Jun 2018 10:56:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 22 Jun 2018 13:55:55 -0400 X-Gmail-Original-Message-ID: Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000ff091e056f3ebeed" Subject: Re: [PHP-DEV] Equality and relative ordering of objects From: rtheunissen@php.net (Rudi Theunissen) --000000000000ff091e056f3ebeed Content-Type: text/plain; charset="UTF-8" What's the best place to override == internally? `do_operation` or a new object handler? I'd like to separate equality from compare_function.. or should we ignore `__equals ` and assume that the values are equal if `__compareTo` returns 0? Here's some context: I'm modifying `is_equal_function` to check for an `__equals` implementation if the value is an object, which I think should work, but it's not clear how an internal object (like the ds structures, for example) should override ==. `do_operation` seems like a good choice for this, but I wanted to check with you all first. On Fri, 22 Jun 2018 at 13:06, Rudi Theunissen wrote: > > Yes, that's the type of thing that I think needs to be included as > > part of the RFC. > > > > Including a list of all the (or at least the important) functions that > > would be affected by this RFC should be made both for clarity and so > > that people can think through any edge cases. > > > Absolutely. I was hoping to gather some thoughts and opinions first while > I > work on the implementation before I submit an official RFC. I'll make sure > to > include what you've mentioned, I completely agree. > > On Fri, 22 Jun 2018 at 11:14, Dan Ackroyd wrote: > >> On 22 June 2018 at 12:31, Rudi Theunissen wrote: >> >> > >> >> I think if you want to push the RFC forward, a really quite strong >> >> case needs to be made for why having it be a language level feature is >> >> so much better (or even at all better) than having it be implemented >> >> in userland. >> >> > >> > >> > 1. You can't override the behaviour of `<`, `<=`, `>`, `>=`, `==`, `!=` >> with >> > a userland implementation. >> > 2. Therefore, you won't be able to affect the internals of array >> functions >> > like `in_array`, `sort` etc. >> >> >> Yes, that's the type of thing that I think needs to be included as >> part of the RFC. >> >> Including a list of all the (or at least the important) functions that >> would be affected by this RFC should be made both for clarity and so >> that people can think through any edge cases. >> >> cheers >> Dan >> > --000000000000ff091e056f3ebeed--