Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102412 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74217 invoked from network); 25 Jun 2018 11:47:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jun 2018 11:47:48 -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.217.169 as permitted sender) X-PHP-List-Original-Sender: rudolf.theunissen@gmail.com X-Host-Fingerprint: 209.85.217.169 mail-ua0-f169.google.com Received: from [209.85.217.169] ([209.85.217.169:44591] helo=mail-ua0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/D2-50433-366D03B5 for ; Mon, 25 Jun 2018 07:47:47 -0400 Received: by mail-ua0-f169.google.com with SMTP id v15-v6so1540712ual.11 for ; Mon, 25 Jun 2018 04:47:47 -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:cc; bh=SoKNbzVwYpSX0C1Qi8efr9BEFaPHKSG9gKG8DSN4d4k=; b=hQAjt+1OIEt3lUbASwXjb/7XZt1wKIvnzsqvMqj66H50zi0jJNGqytW1BFwUWgJnFk Tq+hmj3E4q/Q7PGW9xaNP24GcJBGM/NpYv83mgrDLYF52U44U4kIz/YpfPiB67ye25uX LJFZ2osu7MD7nzVW0ASR8CWeSLYWTuYHnej9lhAA+YrsEPTqovJ+PJSA1zQsFsSv5QSv /VwwpbXafc7ZpaL1Rc7TnyMkRe4qhVwsXFFaeb3buVKV8RkrikPY6OVMGq8TTV8IIsYc IkpaeW/SSHwXe5SIIG3deQ6qirFNskpbi5XXGbvwBCsnWuWoVpgOGUUIdPOUr9N8fUQR Mw4A== X-Gm-Message-State: APt69E3Pv5uKAdUYGSSB8hZ/zHYtPHzOZN41UwcnOxbwcBaeavk/oOcL I8LBHZwW0TlJglUNfF/xkmHIREuV X-Google-Smtp-Source: AAOMgpdJ/xF9w23P9Wzfw9P1qY8AXN7G0NmJLkOjfWmDShDWzSN4ATzsS/VR2uLT0orEk++tkoSJbw== X-Received: by 2002:ab0:4b58:: with SMTP id i24-v6mr1419081uaf.172.1529927265124; Mon, 25 Jun 2018 04:47:45 -0700 (PDT) Received: from mail-vk0-f51.google.com (mail-vk0-f51.google.com. [209.85.213.51]) by smtp.gmail.com with ESMTPSA id i26-v6sm2964618ual.15.2018.06.25.04.47.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 04:47:44 -0700 (PDT) Received: by mail-vk0-f51.google.com with SMTP id n81-v6so1560042vke.6 for ; Mon, 25 Jun 2018 04:47:44 -0700 (PDT) X-Received: by 2002:a1f:b593:: with SMTP id e141-v6mr7756100vkf.171.1529927264196; Mon, 25 Jun 2018 04:47:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 25 Jun 2018 07:47:32 -0400 X-Gmail-Original-Message-ID: Message-ID: To: levim@php.net Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000001d5cfe056f75f352" Subject: Re: [PHP-DEV] Equality and relative ordering of objects From: rtheunissen@php.net (Rudi Theunissen) --0000000000001d5cfe056f75f352 Content-Type: text/plain; charset="UTF-8" > > Java has .equals and .compareTo; these operations are separate. In > Java neither integrates with operators. Yeah that's right. I was just pointing out that Java's == always checks against the reference and you can't override it (so it's like PHP's ===). Their .equals() method is like PHP's ==. I agree that it's better to separate the two operations, which is why the first message in this thread talked about __equals and __compareTo. However, when I started implementing it, I couldn't see a nice way to separate them internally as everything goes through `compare_function`. On Sun, 24 Jun 2018 at 23:31, Levi Morrison wrote: > On Sun, Jun 24, 2018 at 2:31 PM Rudi Theunissen > wrote: > >> > >> Other languages (most? all?) separate equality and ordering for this > reason. > > > > > > Java doesn't really separate them. Their `==` always checks object > reference so is like PHP's ===. > > But they do have the .equals() method on all objects (our ==) and the > collections use that for equality. > > Java has .equals and .compareTo; these operations are separate. In > Java neither integrates with operators. > --0000000000001d5cfe056f75f352--