Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102715 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21589 invoked from network); 10 Jul 2018 14:37:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jul 2018 14:37: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=rudolf.theunissen@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.53 as permitted sender) X-PHP-List-Original-Sender: rudolf.theunissen@gmail.com X-Host-Fingerprint: 209.85.213.53 mail-vk0-f53.google.com Received: from [209.85.213.53] ([209.85.213.53:45296] helo=mail-vk0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/F6-15421-E84C44B5 for ; Tue, 10 Jul 2018 10:37:05 -0400 Received: by mail-vk0-f53.google.com with SMTP id l64-v6so12557603vkl.12 for ; Tue, 10 Jul 2018 07:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XOyLwbX60hE9LORjlNJi5aj7PvqKZ2bOb7N0JjW+O3M=; b=lAdx3tL4aJ59BTlc0J3WEjZnkzQbK2m5U/QEuYVJdgyerPUNGuJez36A2+XvL2qTEP 6Qrm2wg268IQfrZWgUlQFohVrgqOlBYirRjgcJspRuTVkPo0TMCnM/SPCnRefjsFlkk7 VruUJPZOQ7NlY+21P5/EjxGutNO65qobhRRl9HjMva/r2CteN+Ir4fqGT2T/nA2gdZAx LD3etMPmp6Qr/SWXMHYtPdGJyb0Fufv3hcuZQL9V6bmqDYQvMyqB9eESVSxSYTA6yK1H pdyCtc0hpouFzX8pid+5YP6UuaVSzKUGruGArr45JnHdDvgedf5qGZ5/MGngz+p85RsE y22g== 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:cc; bh=XOyLwbX60hE9LORjlNJi5aj7PvqKZ2bOb7N0JjW+O3M=; b=a9hbtTfCAdkElP94KmlV32/96Pbq8N/idINjih6Jge0dzh7FlZdGptRlLN2PKC7q0Y Nr/vVOQBzi6eHcPRMyDQlRQkJpCn1O7EkE8rmaih62d9WBzip62p2i9jewcNLNcHJtQQ N80bzWTPBeuwEblI5O8HbMGA0cw/UYpvb7npH49HvIasgkvlp9PYCL7DUKqhC5dOOOfW 5dhrpaidrE2Y1/craihGx0qhXGgCOUtz5unrCuwWSwq31GWtWggkYYJdPaGeEvy2zOWx HQYbym86zbLxlaQzry/XXDwAbVs/+c8vLsKvIOJMMYIcdzpP0ii/HasDrLkWSobWI4ro S6WA== X-Gm-Message-State: APt69E22+3UWB00Hpd/aYo0P+x5bIYY7Xt7JUfctWlJ9eqzYFr8hbPi3 wnTN1FsmAoVev8+uUp+366q5qsbWI8hYHU5yNZs= X-Google-Smtp-Source: AAOMgpeYDvkpZiXCZn1qIfWAlno3cdrs1V1JhOwLARw7cYm9EosRTnRj63tRKOZoKxDXyVT6FUnv1Jkshnw4qDBEUeo= X-Received: by 2002:a1f:7c84:: with SMTP id x126-v6mr14230052vkc.105.1531233420346; Tue, 10 Jul 2018 07:37:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 10 Jul 2018 10:36:49 -0400 Message-ID: To: ocramius@gmail.com Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000168a060570a610b0" Subject: Re: [PHP-DEV] Re: [RFC] [VOTE] User-defined object comparison From: rudolf.theunissen@gmail.com (Rudolf Theunissen) --000000000000168a060570a610b0 Content-Type: text/plain; charset="UTF-8" Thanks for explaining your vote Marco. I realise it's probably too late but I'd like to respond anyway. 1. I was hoping that this proposal would reduce those edge cases and make `==` on objects something useful. 2. That's true, but there are so many gotchas with the current behaviour that I wouldn't say it works *well*. Also no strict comparison. 3. We shouldn't need to ever use `method_exists()`? Everything can be compared, so tests for implementation are effectively useless. If this is not the case in the future we can introduce interfaces for Comparable and Equatable that abstract and implied by the presence of the methods (Golang style). I don't foresee this to ever happen though. 4. "Equal ordering implies equality" is primarily to keep consistent with current behaviour - PHP doesn't treat them as separate things today. 5. This was a difficult trade-off between flexibility and consistency. I opted for a wider approach that can be narrowed later if we really want to. Happy to discuss further. Rudi On Tue, 10 Jul 2018 at 05:35, Marco Pivetta wrote: > Heya! > > Just some background on my -1 vote: > > 1. the `==` operator is already riddled with edge cases and complexity, > and it is overall advisable to stay away from it > 2. comparison of value objects already works correctly with `==` (if we > don't consider edge cases like `'0.' == '0.0'`) > 3. the suggested approach is to add more interface-less reserved/magic > methods: an `Eq` and an `Ord` class would have solved this much more > elegantly and with clear type declarations that can be re-used in userland. > With this patch, we have to rely on `method_exists()` instead. > 4. It would also be much clearer to enforce that `Ord extends Eq`, rather > than adding implicit "sorting implies equality" rules > 5. "the methods are not restricted to instances of the same class" - this > is something I disagree with, but we lack the type system facilities to > declare the variance of the `Eq` and `Ord` operations for a specific class. > > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > > On Mon, Jul 9, 2018 at 8:57 PM, Rudolf Theunissen < > rudolf.theunissen@gmail.com> wrote: > >> Apologies for that middle discussion link, it was a bad hyperlink from a >> bad paste if you look at source. >> >> Here are the correct ones: >> >> *Discussion:* >> - https://externals.io/message/102337 >> - https://externals.io/message/102473 >> >> >> >> On Mon, 9 Jul 2018 at 13:57, Rudolf Theunissen < >> rudolf.theunissen@gmail.com> >> wrote: >> >> > Hi everyone, >> > >> > With no further discussion and no objection to start voting on this >> RFC, I >> > would like to move forward with the vote, which requires a 2/3 majority >> to >> > pass. >> > >> > *RFC*: https://wiki.php.net/rfc/object-comparison >> > >> > Discussions: >> > - https://externals.io/message/102337 >> > (June 21) >> > - https://externals.io/message/102473 (June 26) >> > >> > The vote will be open until 2018-07-16. >> > >> > Thank you, >> > Rudi >> > >> > >> > > --000000000000168a060570a610b0--