Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102475 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50495 invoked from network); 27 Jun 2018 01:04:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2018 01:04:54 -0000 Authentication-Results: pb1.pair.com header.from=netmo.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=netmo.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.180 as permitted sender) X-PHP-List-Original-Sender: netmo.php@gmail.com X-Host-Fingerprint: 209.85.216.180 mail-qt0-f180.google.com Received: from [209.85.216.180] ([209.85.216.180:43190] helo=mail-qt0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/87-01794-5B2E23B5 for ; Tue, 26 Jun 2018 21:04:54 -0400 Received: by mail-qt0-f180.google.com with SMTP id c8-v6so281355qtp.10 for ; Tue, 26 Jun 2018 18:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vb1TJG6dzVjTLe595jk/2SjGm13vyFPeO3uSrwa6RXE=; b=MeogvRPikS2gla1d5Ino1HvIRt+o6ZPaK3KpNWEjhqIlG/PGzS+88B6ctLXYgQXe+U vWhQUoAPmyc3biq8gFyu0VABAAbx55XxAQYxklxkR2ESCm0jA9ZlGCCIswBOvPhloOzD 9n/frM9Dj7XDVVpGKMSC9O+IOaHCaPIyb94B2ix4uf7yHI+uw2rCfXzSO1CcldQUoyQf RunGBDQMA1OZQossix8ZF1Bg3ef5IY8wiTyA0+TcQbLEjbWKgl/GdwcaXAZIWugf1H09 exgBq0rgykK9j7yXN9g0zAAUQQjqslAZLqWDg4ggorjz/Ri0xLqm3A/1AYPCpTX0IGzx J9Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vb1TJG6dzVjTLe595jk/2SjGm13vyFPeO3uSrwa6RXE=; b=Wh5lz0BwIEpxZ42Kvsp0KNvxrbtfMabp+zw9Terwx0/QPNKZxfdngrbd9mNJ0O3eJX 51pj5O+qVXBiZel6e2MFUf9CXLX9UQINiBNLc2c7feZ0Peu8Bbq/e5jfvx9nEjoD6igj /cXq2D1dFDOkcziJGoORl8CwgfV5r/oRKDysP3ZygIVV+s4m6QeHbxD5j7Rzw0/ERAkF 2/niePpzMxXltv1HDPZQPwdV44RxNv/67cISz2vT7a9dh2i30XZmaNnFDKSPYVeGeINU i0qjFzueTvI4fW/nXHIWfnJe8OEE9cfu6+wgjZdB2e8fFJYXjJ6M+u+UbPnwVhB1gtML XR9A== X-Gm-Message-State: APt69E2xmzlHsAZ+/4Zi5fip4tY9I8g3A/Uj3tesxN0AhYW87cbPAA5G Vf8PwFkLnzM8qpKq0Juik3ew1l8rkZti4XU057c= X-Google-Smtp-Source: AAOMgpcFRfCFtLlL+RR0kHKFHKdL3Z114cFfW7Zw0pwah6ysMDnEUcC3abEUA0wUuUHD+rjLZLDlkR1bkqD3Unz0CdE= X-Received: by 2002:ac8:2e83:: with SMTP id h3-v6mr3599075qta.365.1530061490109; Tue, 26 Jun 2018 18:04:50 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac8:34f0:0:0:0:0:0 with HTTP; Tue, 26 Jun 2018 18:04:49 -0700 (PDT) In-Reply-To: References: Date: Wed, 27 Jun 2018 03:04:49 +0200 Message-ID: To: Rudolf Theunissen Cc: PHP Internals Content-Type: multipart/alternative; boundary="0000000000009a43e8056f953368" Subject: Re: [PHP-DEV] [RFC] User-defined object comparison From: netmo.php@gmail.com (Wes) --0000000000009a43e8056f953368 Content-Type: text/plain; charset="UTF-8" some ideas and concerns: - I would like to see this in an extension first, i think it's perfectly doable and people can test it before merging to core - would be nice if compareTo and equals were used only if left operand and right operand used the same comparator function. In other words, $a == $b must not work if $a->__equals and $b->__equals are two different functions - otherwise RFC should specify the precedence. if $left operand and $right operand both have the magic methods, it will call $left->__magic($right), otherwise, if only the right one has the handler? what if the right one has compareTo and the left has only equal? you probably should add a table that explains which method is called depending in the availability of the two magic methods in the operands. - I'd introduce a debug mode that forces php to call both $left->__equals($right) and $right->__equals($left) so that symmetry is guaranteed by design. You could do that when "assertions" are active. gl --0000000000009a43e8056f953368--