Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79739 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76553 invoked from network); 16 Dec 2014 18:44:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2014 18:44:28 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.48 mail-wg0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:45292] helo=mail-wg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/60-08594-A8D70945 for ; Tue, 16 Dec 2014 13:44:27 -0500 Received: by mail-wg0-f48.google.com with SMTP id y19so18176855wgg.7 for ; Tue, 16 Dec 2014 10:44:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type:subject:from:date:to :message-id; bh=g38l4gDeVgQbc7F/Cbneti3URckkT6vg3WbiYQvsVgo=; b=bVswHDgyshOJJMs1irZYbAZMQbsSa8qba1W1ZARX4V02ZMEPYstWrubZL3yG+x33n6 ymY+2ySJWzoMzcWcUFCUb0DIV5o2A5axC1IhvD8bdGnCkxMlG5tVkI5RZ3Mm3fBHlVpM T+qEUEKUOvXDZSaL50GERD/ZkOXxIqrnBerMpNEY/4IYIgxMtoGwwRHycd020eKea3qd pZA6NU1PuNKPmJCOwA3SKvUVHECqBmQfgkI2kqAhiB/pLiu5yrzrV2JhnDq0psHX4rU2 9EOFgCD0to8gnvKnXBnI9DhqCkjjbYo5uxBEWVigNjKr7/wbukXOF8ljqGNC31y1r3yB 8phg== X-Received: by 10.194.5.227 with SMTP id v3mr65757217wjv.63.1418755463734; Tue, 16 Dec 2014 10:44:23 -0800 (PST) Received: from [192.168.0.3] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id p14sm3150969wie.1.2014.12.16.10.44.22 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 10:44:23 -0800 (PST) User-Agent: K-9 Mail for Android In-Reply-To: <54907683.2070509@gmail.com> References: <548FEE87.7020602@gmail.com> <549009EE.7040808@fischer.name> <54907683.2070509@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Date: Tue, 16 Dec 2014 18:44:20 +0000 To: internals@lists.php.net Message-ID: <8AB6896C-D5DB-4471-BBD5-60784B2FC1BE@gmail.com> Subject: Re: [PHP-DEV] [RFC][VOTE] Objects as Keys From: rowan.collins@gmail.com (Rowan Collins) On 16 December 2014 18:14:27 GMT, Stanislav Malyshev wrote: >Hi! > >> I was previously in favour of this, but it’d prevent actual indexing > >No, of course it won't - if we ever introduce indexing objects (which >probably will require rewrite of the HashTable, any takers?) it would >be >very easy to index any object that does not implement __hash without >any >BC problem, and convert all those implementing __hash to "return $this" >if desired. > >> by objects in future, and I can’t think of any use cases which >> aren’t better solved by explicitly converting to a string/integer. > >There's no implicit conversion, and explicit one is a) inacessible in >userspace for anything but string and b) annoying for the same reasons >for which __toString exists. Explicit conversion is trivial, just call whatever method you like. Sure, you can't write (int)$obj, but $obj->toInt() is just as expressive.