Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79717 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4008 invoked from network); 16 Dec 2014 11:34:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2014 11:34:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.53 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.192.53 mail-qg0-f53.google.com Received: from [209.85.192.53] ([209.85.192.53:63468] helo=mail-qg0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 97/95-07463-6C810945 for ; Tue, 16 Dec 2014 06:34:30 -0500 Received: by mail-qg0-f53.google.com with SMTP id l89so10094344qgf.12 for ; Tue, 16 Dec 2014 03:34:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=6d90lOcZURAhwS/EMknbtBtY9Iu71Ifj1jAT5+hGFdg=; b=r3HVdtECvymh5Y1d2iUGmnyy4wVF2R6Hact3OymX8sLh5svVudpuYcbF6fD0DZJwBd zlC4bBeKA+cJSFq9LCPwSNvkWNMiBgS55VTOt1Ydhf8X6LAC+oypRo5Kx7kyHu6Gps2T Lxyvy5KByl4QJf/R5oqJxnVL4J8yJMtBILYmGDB5N3SZ3npTN/M8TQDDIaOU74IdhWKr faAGSd9EQ+7du8vhrS0+B9kG4tI74J8oFOZZgRE42VBzoddv4mxgcVrdwHLPr+XSJI73 wMLdZzpqMr8y+xo8Cs9cAuJI7rhcR8RbhuYseb6J5ufYLDLn2MDHIY2OnZJlus4CYkto fLoA== X-Received: by 10.224.51.11 with SMTP id b11mr64501834qag.43.1418729667247; Tue, 16 Dec 2014 03:34:27 -0800 (PST) Received: from [192.168.1.104] ([187.66.190.236]) by mx.google.com with ESMTPSA id v5sm489270qaj.2.2014.12.16.03.34.25 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 03:34:25 -0800 (PST) References: <548FEE87.7020602@gmail.com> <549009EE.7040808@fischer.name> <216D6925-EB1A-49E0-AD6B-42100C2F81DB@ajf.me> Mime-Version: 1.0 (1.0) In-Reply-To: <216D6925-EB1A-49E0-AD6B-42100C2F81DB@ajf.me> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <7DEC4844-DBDC-4E09-9F4A-0619252BE284@gmail.com> Cc: Markus Fischer , "internals@lists.php.net" X-Mailer: iPad Mail (12B435) Date: Tue, 16 Dec 2014 09:34:23 -0200 To: Andrea Faulds Subject: Re: [PHP-DEV] [RFC][VOTE] Objects as Keys From: guilhermeblanco@gmail.com (Guilherme Blanco) Hi, All I can say is that the lack of this feature is one of the main reasons wh= y Doctrine doesn't fully work with composite keys. With this enhancement it would now become possible to implement a proper Ide= ntityMap. []s, On Dec 16, 2014, at 9:05 AM, Andrea Faulds wrote: >>=20 >> On 16 Dec 2014, at 10:52, Andrea Faulds wrote: >>=20 >> Exactly. If I were to do this: >>=20 >> > class Foo { >> public $foo; >> function __construct($foo) { >> $this->foo =3D $foo; >> } >> function __toKey() { >> return $this->foo; >> } >> } >> $arr =3D []; >> $arr[] =3D new Foo(1); >> var_dump($arr); >>=20 >> I would get this: >>=20 >> array(1) { >> [0]=3D> >> int(1) >> } >=20 > Er, a correction=E2=80=A6 the example should=E2=80=99ve been something lik= e this: >=20 > $arr =3D []; > $arr[new Foo(1)] =3D NULL; >=20 > Producing this: >=20 > array(1) { > [1]=3D> > NULL > } >=20 > Obviously, it has no effect on values, only keys, sorry! >=20 > -- > Andrea Faulds > http://ajf.me/ >=20 >=20 >=20 >=20 >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20