Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:63273 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34161 invoked from network); 7 Oct 2012 23:51:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2012 23:51:52 -0000 Authentication-Results: pb1.pair.com header.from=theanomaly.is@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=theanomaly.is@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: theanomaly.is@gmail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:51123] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E0/C5-07529-89512705 for ; Sun, 07 Oct 2012 19:51:52 -0400 Received: by mail-lb0-f170.google.com with SMTP id gm13so2619041lbb.29 for ; Sun, 07 Oct 2012 16:51:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ierT6/pOu9Ev05iJ38eddWFUR7p+j3QsINTHqSBovWQ=; b=roR4DVRwLxS5WT4BAjmLvDiUIjWPNXztTWd6Hg+wVI9AOOXUxQA2zwRR2aJ4TtrBoB OTrVppNUw/2iLp8wZtViBa5fvarjWYSG1gk/cxqK/vWIqLVjoD73cgXm9hiwE70eDXeb l/2fZcx4Oh0/fY0/y4DnmEvW/kuuRw+9QxYqoRBqdY12+kG2cOfkRfXoDDelyVu8El7Z E1ayQUUVu21YWWmqMMIpJAbhYQMW+/VMk3KVDfWf+k7+WgSRVlRM++hAS2Rqb+1GccQl xeHrpfgIpsbgnCKB6g4olquGWSmz4sL8yB52eKxD4tJi9tJzHc6d+NiwJQxgbURVaSlO Qd4w== MIME-Version: 1.0 Received: by 10.112.100.197 with SMTP id fa5mr5963613lbb.59.1349653908722; Sun, 07 Oct 2012 16:51:48 -0700 (PDT) Received: by 10.112.12.178 with HTTP; Sun, 7 Oct 2012 16:51:48 -0700 (PDT) In-Reply-To: References: <20121007200604.CGVT23973.aamtaout03-winn.ispmail.ntl.com@p2> Date: Sun, 7 Oct 2012 19:51:48 -0400 Message-ID: To: Rasmus Schultz Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: Arrays which have properties of sets From: theanomaly.is@gmail.com (Sherif Ramadan) On Sun, Oct 7, 2012 at 7:12 PM, Rasmus Schultz wrote: > the manual states, "The implementation in SplObjectStorage returns the > same value as spl_object_hash()" - so I don't know how this would > really work any better than a custom implementation. > > perhaps safer would be to simply implement a collection-type that > requires the classes of elements in the collection to implement an > interface, exposing a unique key... and for objects that don't have a > unique key, generate sequential keys from a static counter in each > class... not ideal if you want to implement a document store that can > store "anything", since now every stored object/class needs to provide > a key... > How is that safer? If anything this introduces every aspect of being unsafe since relies on a user implementation that may or may not exist and may or may not be unique. As opposed to spl_object_hash, which can actually identify objects uniquely by looking at the internal symbol table that exposes all the objects in memory. > On Sun, Oct 7, 2012 at 4:06 PM, Jared Williams > wrote: >> >> See SPL's SplObjectStorage. That allows object instances as keys. >> >> Jared > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >