Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41521 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4897 invoked from network); 28 Oct 2008 14:23:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Oct 2008 14:23:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=kalle.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kalle.php@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.188 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: kalle.php@gmail.com X-Host-Fingerprint: 209.85.128.188 fk-out-0910.google.com Received: from [209.85.128.188] ([209.85.128.188:2056] helo=fk-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3D/B7-00734-74027094 for ; Tue, 28 Oct 2008 09:23:04 -0500 Received: by fk-out-0910.google.com with SMTP id 18so2710154fks.7 for ; Tue, 28 Oct 2008 07:23:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=xhIll1zC9+N3r5cPrPLjPOihux22wT1c2PAM17wTqLU=; b=HDprdxT25HKLz1KM7x85GV6duoPL1185j84xV9fqih4tOG9oA1Q5g4e8rUvmZ4Lz94 eyl7Rkru07Eh/k/ZFJ6d9kmhkR4CaqiH3PY95sUTJ2AGZkWt8i3f5vfsNMpwmiB12SX6 LIqM4G3PB7xzln6qfRqAf1Wl30DM0Y2bfMGPg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=HNWwaZv3QBg55GKnYOqjA31BawfaNZcik9F7wed30oZDiSyURJ4bv8TUY00YV9QgUz XTiBI6KJIFIeaXEJ4Kj+iqEE2hePWOE+GkPB12w9mMbVfqbn/+/ysWLXCOtyUMmJqs0G 5bu6KDNY9mRitpUS11cUBbIZKhs0/x2Qyjfro= Received: by 10.187.210.10 with SMTP id m10mr691984faq.13.1225203780838; Tue, 28 Oct 2008 07:23:00 -0700 (PDT) Received: by 10.187.218.19 with HTTP; Tue, 28 Oct 2008 07:23:00 -0700 (PDT) Message-ID: <2dedb8a0810280723m2f021a5bsc1850249ebdd4fc9@mail.gmail.com> Date: Tue, 28 Oct 2008 15:23:00 +0100 To: "Ionut Gabriel Stan" Cc: "Lars Strojny" , "Andrei Zmievski" , "=?ISO-8859-1?Q?Johannes_Schl=FCter?=" , "Alexey Zakhlestin" , "Mark van der Velden" , "Stanislav Malyshev" , "PHP Internals" In-Reply-To: <49071AF4.6080908@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4900DB81.4000805@zend.com> <4900E150.1010607@dynom.nl> <49018FC3.90302@gmail.com> <1224854888.19390.89.camel@goldfinger.johannes.nop> <490609A1.7090400@gravitonic.com> <1225199800.878.0.camel@localhost> <49071AF4.6080908@gmail.com> Subject: Re: [PHP-DEV] array_key_exists BC break From: kalle.php@gmail.com ("Kalle Sommer Nielsen") Hi Ionut 2008/10/28 Ionut Gabriel Stan : > While we're at this and considering the new lambdas that we now have in the > language > I must say I'd like some functions to support Traversables. Those would be: > > array_map(), array_reduce(), array_filter(), array_walk() and > array_walk_recursive() > > Although I'd rather want a class (because the array_* functions don't adhere > to some strict param order standards) > to provide functional style methods, like those in Javascript 1.8: > > https://developer.mozilla.org/index.php?title=En/New_in_JavaScript_1.6#section_2 > https://developer.mozilla.org/index.php?title=En/New_in_JavaScript_1.8#section_4 > > Array.forEach() > Array.map() > Array.filter() > Array.reduce() > Array.reduceRight() > Array.some() > Array.every() > > > In PHP something like this would be nice: > > $processedDirectoryIterator = SplFunctional(new > DirecotoryIterator(__DIR__)).map(function() { > // do stuff here > }); This would indeed be nice, but theres one thing yet, PHP doesn't support closure objects, take for example: hello('Kalle'); // Fatal error, undefined method Closure::hello() But you should indeed make an RFC for this and even create a patch if you're able to :) > > where SplFunctional is a function returning a SplFunctional object whose > construcor accepts iteratable > structures (arrays or Traversables) and $processDirectoryIterator is a > DirectoryIterator resulted after applying > the lamba to each of the SplFileObjects contained. > > I know right now we have FilterIterator as an equivalent to array_filter() > for Iterators and we could implement our > own Functional classes but that means a new class for situations where a > simple lambda could do the job > just as well. > > I hope my proposal makes sense. > > > P.S. I introduced a SplFunctional function just to skip the instantiation of > the object. > > > > On 10/28/2008 15:16, Lars Strojny wrote: >> >> Hi Andrei, >> >> Am Montag, den 27.10.2008, 11:34 -0700 schrieb Andrei Zmievski: >> [...] >> >>> >>> I would say "no" for 5.3. But for 6 it would be fantastic to have all >>> array-related >>> operations supporting ArrayAccess interface, where possible. >>> >> >> +1 for this. >> >> cu, Lars >> > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Kalle Sommer Nielsen