Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65374 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44153 invoked from network); 29 Jan 2013 13:15:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2013 13:15:47 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.174 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.128.174 mail-ve0-f174.google.com Received: from [209.85.128.174] ([209.85.128.174:44793] helo=mail-ve0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0F/F6-10721-C7BC7015 for ; Tue, 29 Jan 2013 08:15:46 -0500 Received: by mail-ve0-f174.google.com with SMTP id c13so251921vea.5 for ; Tue, 29 Jan 2013 05:15:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=voxysBq9xNDrqRO8OwAO6zMOsdy2fZObVb50SuvSyB4=; b=TEOdNLzCiIBxhOlsJbKdnLsN20TPmFCPV0zx76Y/ggCGlC6y9Ueob5gE2WHz4J8Es9 /QJCqA0snVfG6SKJGblKvDGjDCRloB21MriUiJL/XF9xjyrC9K88aojsje15Wahs6sv8 RQG5SDCPQlKBhHERwZXWeG7xOSNHIu8LuCmmrQKzrxE+6x7glS4kUx33qvKHCphcSwmk bRmOr4ttQBpssQy2ycnb+7jJsSNYpsi4KLuE2lWb3vDkJ0BvkI+mrxaHJ3oerQXyhKwM w2KxzacPiRgbGZd47GA0xjhw4ubm2/jMwRDRcWEH/brSLh6U8dDwxSAgq5q/4XMVcLfs KaZw== MIME-Version: 1.0 X-Received: by 10.220.40.9 with SMTP id i9mr904174vce.23.1359465328285; Tue, 29 Jan 2013 05:15:28 -0800 (PST) Received: by 10.58.56.137 with HTTP; Tue, 29 Jan 2013 05:15:28 -0800 (PST) In-Reply-To: References: Date: Tue, 29 Jan 2013 08:15:28 -0500 Message-ID: To: Rasmus Schultz Cc: PHP internals Content-Type: multipart/alternative; boundary=bcaec54a3788fa165404d46d2fc1 Subject: Re: [PHP-DEV] rfc:foreach-non-scalar-keys From: ircmaxell@gmail.com (Anthony Ferrara) --bcaec54a3788fa165404d46d2fc1 Content-Type: text/plain; charset=ISO-8859-1 Rasmus, Relax. It hasn't even been proposed yet. Give the author some time to finish the RFC before proposing it here, and then we can discuss it... Anthony On Tue, Jan 29, 2013 at 8:03 AM, Rasmus Schultz wrote: > I just saw this RFC: > > https://wiki.php.net/rfc/foreach-non-scalar-keys > > By "non-scalar", presumably we're talking about objects? In the numbers > that e.g. resources typically get used, having a collection indexed by > resources would seem like an extremely exotic need. > > Moreover, we already have this: > > http://php.net/manual/en/class.splobjectstorage.php > > I just want to note that, while allowing non-scalar keys may seem like a > natural addition, we're not talking about a simple change to the foreach > statement - we're talking about a fundamental change to the array type. > > So I will point out two things: > > 1. Allowing non-scalar keys in arrays takes away an error-condition that > would normally be reported: accidentally using an object as a key (which > could even work in some cases, and could cause objects not to be garbage > collected.) > > 2. SplObjectStorage already solves this problem - minus e.g. resources, but > you could put your resources in an object and address that (very exotic) > need. > > Bottom line, I'm not in favor of this idea - it just doesn't seem necessary > or really even beneficial to me. > > - Rasmus Schultz > --bcaec54a3788fa165404d46d2fc1--