Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78372 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3433 invoked from network); 27 Oct 2014 06:53:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Oct 2014 06:53:21 -0000 Authentication-Results: pb1.pair.com header.from=php@bof.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php@bof.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain bof.de designates 80.242.145.70 as permitted sender) X-PHP-List-Original-Sender: php@bof.de X-Host-Fingerprint: 80.242.145.70 mars.intermailgate.com Received: from [80.242.145.70] ([80.242.145.70:40340] helo=mars.intermailgate.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/17-56216-EDBED445 for ; Mon, 27 Oct 2014 01:53:19 -0500 Received: (qmail 30994 invoked by uid 1009); 27 Oct 2014 07:53:15 +0100 Received: from 209.85.216.174 by mars (envelope-from , uid 89) with qmail-scanner-1.25-st-qms (clamdscan: 0.96.2/19534. spamassassin: 3.3.1. perlscan: 1.25-st-qms. Clear:RC:1(209.85.216.174):. Processed in 0.105687 secs); 27 Oct 2014 06:53:15 -0000 X-Antivirus-MYDOMAIN-Mail-From: php@bof.de via mars X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:1(209.85.216.174):. Processed in 0.105687 secs Process 30988) Received: from mail-qc0-f174.google.com (gmail@bof.de@209.85.216.174) by mars.intermailgate.com with RC4-SHA encrypted SMTP; 27 Oct 2014 07:53:15 +0100 Received: by mail-qc0-f174.google.com with SMTP id r5so372584qcx.33 for ; Sun, 26 Oct 2014 23:53:13 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.140.39.134 with SMTP id v6mr28286452qgv.19.1414392793842; Sun, 26 Oct 2014 23:53:13 -0700 (PDT) Received: by 10.140.43.68 with HTTP; Sun, 26 Oct 2014 23:53:13 -0700 (PDT) Received: by 10.140.43.68 with HTTP; Sun, 26 Oct 2014 23:53:13 -0700 (PDT) In-Reply-To: <544DA1CD.9070109@php.net> References: <544DA1CD.9070109@php.net> Date: Mon, 27 Oct 2014 07:53:13 +0100 Message-ID: To: Stas Malyshev Cc: internals Content-Type: multipart/alternative; boundary=001a11c120e40cd731050661fcf7 Subject: Re: [PHP-DEV] [RFC] Using objects as keys From: php@bof.de (Patrick Schaaf) --001a11c120e40cd731050661fcf7 Content-Type: text/plain; charset=UTF-8 Am 27.10.2014 02:37 schrieb "Stas Malyshev" : > > I would like to present to your attention an RFC about using object as keys: > >https://wiki.php.net/rfc/objkey I don't like this, mainly because it blocks a future direct use and storage of objects as keys in an array, i.e. what SplObjectStorage does. It is also badly named, because it does NOT implement objects as keys. It implements deriving surrogate keys from objects when used in an array key context. This is not what other languages do. Python, for example, uses a combination of __hash__ and __eq__ (or __cmp__), the former to locate the hash slot, and the latter to then check for equality when running the hash chain anchored in that slot. The thing stored as a key, is the real object. See https://wiki.python.org/moin/DictionaryKeys best regards Patrick --001a11c120e40cd731050661fcf7--