Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62348 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19973 invoked from network); 21 Aug 2012 18:53:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2012 18:53:59 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.182 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.212.182 mail-wi0-f182.google.com Received: from [209.85.212.182] ([209.85.212.182:43833] helo=mail-wi0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/D1-10139-549D3305 for ; Tue, 21 Aug 2012 14:53:58 -0400 Received: by wibhq12 with SMTP id hq12so101325wib.11 for ; Tue, 21 Aug 2012 11:53:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=n25VFzXjpx75aMb7klBoFTwFukQC8mQ3qmlgbu4A5DM=; b=z9cCwJOdM4VCQeqmqLq9pLDIUv7URQ1u+i6emu3SqR8BxpLpysWrfc9hQHviUyS9/2 BWKUzuh3yEY375IIrIxJgU2aNVLPo/65LoK0F7iAULRAvWcQX4bLLZoUKo9v1bBpH6jF nA7nXXhS639+oUc8+c9b9kAinPyzlsG2y5VZ139GKhi5BT0jGVAyxk+Tia945uIgMpOh VQ6hBu/RmK0qV9F1flY0tvRrn+JOusPMOaZcMSbFdFIvdCoxqGDlcYevK5sfUX5UGcVU u9YtkjFj6o0O5FiVcLX55jYvXNJ6ywRTdpB9yaVKgtuQtrQy8K+c8XK/sx2jb8uYLJlP utOw== Received: by 10.216.181.195 with SMTP id l45mr9508564wem.52.1345575234466; Tue, 21 Aug 2012 11:53:54 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.223.86.201 with HTTP; Tue, 21 Aug 2012 11:53:13 -0700 (PDT) In-Reply-To: References: <502EB667.1020602@lerdorf.com> Date: Wed, 22 Aug 2012 03:53:13 +0900 X-Google-Sender-Auth: GL8g_4Jd4vtvqsBQx7giRFZg_9A Message-ID: To: Levi Morrison Cc: Tjerk Anne Meesters , Rasmus Schultz , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] re: removing an item from an array From: yohgaki@ohgaki.net (Yasuo Ohgaki) Hi, 2012/8/21 Levi Morrison : > On Tue, Aug 21, 2012 at 3:36 AM, Yasuo Ohgaki wrote: >> Hi >> >> 2012/8/21 Tjerk Anne Meesters : >>> On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz wrote: >>> >>>> Thank you, but this isn't really anything like what I had in mind. >>>> >>>> What I had in mind is more like set-semantics for arrays, e.g. designed to >>>> work with sets of distinct values/objects. >>>> >>>> Since I do not have permission to write on the wiki, I posted an initial >>>> draft here: >>>> >>>> https://gist.github.com/321ad9b4b8c4e1713488 >>> >>> >>> Just an idea, since array_delete() may remove multiple values, I would >>> change the return value to (int) and return how many elements were removed >>> from the array. >> >> Int would be better and callable should be accepted like array_walk(). >> It's better to have array_delete_recursive(), too. >> I updated the page. >> >> array_add() needs more discussion. >> What we should do with array value, accept callable or not, etc. >> >> Regards, >> >> -- >> Yasuo Ohgaki >> yohgaki@ohgaki.net >> > > I'm against this RFC, but if you are going to even try to add > something, please keep it consistent! Don't modify `array_delete` to > take a callable, instead make a different function `array_udelete` or > something. > Original proposal is adding array_delete() and this is under discussion. We don't have to add array_add() > And keep default $strict values consistent with existing functions > that have that parameter. Users should use array_walk() when they would like to delete element(s). To be consistent, it should be callable. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net