Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65371 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40763 invoked from network); 29 Jan 2013 13:03:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2013 13:03:45 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 209.85.212.48 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.212.48 mail-vb0-f48.google.com Received: from [209.85.212.48] ([209.85.212.48:45623] helo=mail-vb0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0C/46-10721-FA8C7015 for ; Tue, 29 Jan 2013 08:03:44 -0500 Received: by mail-vb0-f48.google.com with SMTP id fc21so234414vbb.35 for ; Tue, 29 Jan 2013 05:03:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=aeCOQlWd0g8TP8NmNjqUJowt0o25518YKFGKVW1Jvf4=; b=BRyAjLJhOmqcT75XEn9E/ADX+r/1PMKcGf3NRvGQmu+ANNo9KymopB7Lw+3UeXHpam EGXJCy02obdSCbJ9N7QUx/HQcCNEG30dR3RGjXWxgKPjCLOQ1Z+ZZou03WHrUIMQSKO2 ZCbX7qT+vwcdMrbOH15xhJvqfBYpZ6Rm9xroCWYYX0Av/A0Tz7eLswpq2gxNlFn3WmRl cmn36VgQTM8Z4zwBbA7GIOPIqoqWC2mAQ/jhUU/CARcL9Do38WbpNTdn18eIWAzx0p5h qG4NhDcBeExWlS923lFlvXkwgMRpIMpSFcV2HHtNncZYZfbK8v2ZhS8pTq0PmdKcGCRx VwSg== MIME-Version: 1.0 X-Received: by 10.220.150.210 with SMTP id z18mr875734vcv.2.1359464620802; Tue, 29 Jan 2013 05:03:40 -0800 (PST) Received: by 10.58.102.137 with HTTP; Tue, 29 Jan 2013 05:03:40 -0800 (PST) Date: Tue, 29 Jan 2013 08:03:40 -0500 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary=f46d04389427cec11604d46d0531 X-Gm-Message-State: ALoCoQmmULUwWOEFPGa7+7hiKrwmNSBmhp/bt39INbfPlHJvQ4z8pJBPL5s2l9yNB0lQrKqlklTz Subject: rfc:foreach-non-scalar-keys From: rasmus@mindplay.dk (Rasmus Schultz) --f46d04389427cec11604d46d0531 Content-Type: text/plain; charset=ISO-8859-1 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 --f46d04389427cec11604d46d0531--