Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79789 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28521 invoked from network); 17 Dec 2014 18:42:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Dec 2014 18:42:32 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.171 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.171 mail-pd0-f171.google.com Received: from [209.85.192.171] ([209.85.192.171:41720] helo=mail-pd0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 53/00-28186-79EC1945 for ; Wed, 17 Dec 2014 13:42:32 -0500 Received: by mail-pd0-f171.google.com with SMTP id y13so16721583pdi.2 for ; Wed, 17 Dec 2014 10:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=89Cb82IlyX+Q+9poAWrZ4SWkxI5dGJ4DmfAcpU0nZX0=; b=Lhv/FtapUqixP8PRgWyheONrJpbu37OMNcQSUJ0fIJ5F580ROP0mR9Yl7Duw9Q30vw buJeVk6qc4hdJwYAV/0h6Pl1tKpAKl6O8O0SOUm5mvcBvvbkVGukV/5HhlOQrC8vViRa 74HXdPX1bZjN46yob5NCYDnMAqyYXnLGGQuZmmuexaOimNlnPUBbXQVOaHLphsV7gHS7 NZWNAVCPv7iGD+mPfHNDXNdprQZiSBGcthOaI64vMJ/XxwRWNyYS+poAw4oJGiXxVAiv 6bre+AI3o4K7iz/F+86Z84xfZ4n7LzFtctSfPwwHPXGCI4t201caBNDSBOGPSVXooRKp b+hw== X-Received: by 10.66.90.201 with SMTP id by9mr72051906pab.148.1418841748772; Wed, 17 Dec 2014 10:42:28 -0800 (PST) Received: from stas-air.corp.wikimedia.org (tan4.corp.wikimedia.org. [198.73.209.4]) by mx.google.com with ESMTPSA id kg2sm3750176pbc.72.2014.12.17.10.42.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Dec 2014 10:42:28 -0800 (PST) Message-ID: <5491CE95.7060909@gmail.com> Date: Wed, 17 Dec 2014 10:42:29 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Levi Morrison CC: PHP Internals References: <548FEE87.7020602@gmail.com> <5491B77A.4020004@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][VOTE] Objects as Keys From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > This RFC proposes that we store the hash of an object instead of the > actual object. That's simply not useful to me Fair enough, but this is not only about what is useful personally to you. > and likely prevents us > from adding support for objects as keys in the future should we want No it does not. It was already explained several times. If it is ever introduced, it can be used for objects that do not explicitly request functionality in this RFC by enabling __hash() with no BC issues, since this RFC only affects classes that explicitly ask for this specific functionality. So if you, according to the above, would never use __hash, absolutely nothing would prevent you from using objects as keys if it ever happens (which it probably won't in the next 2-3 years). > In addition, it adds yet another behavior to arrays which do so many > things already. I would much rather have structures that focus on It's exactly the same behavior, just available for select objects now. Arrays don't do anything new, they still store key/value pairs, objects do something new to enable you doing more things with value objects. > I would much rather have structures that focus on narrow responsibilities and do that well, such as an improved Map structure instead of SplObjectStorage Nothing in this RFC prevents you from having such structures. In fact, this RFC would enable more convenient handling of such structures, providing common method for requesting the programmable hash value of the object - a feature which most languages have, but PHP does not. -- Stas Malyshev smalyshev@gmail.com