Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41519 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 856 invoked from network); 28 Oct 2008 14:01:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Oct 2008 14:01:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=ionut.g.stan@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ionut.g.stan@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 66.249.92.172 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ionut.g.stan@gmail.com X-Host-Fingerprint: 66.249.92.172 ug-out-1314.google.com Received: from [66.249.92.172] ([66.249.92.172:20274] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/F6-00734-15B17094 for ; Tue, 28 Oct 2008 09:01:55 -0500 Received: by ug-out-1314.google.com with SMTP id 39so261280ugf.37 for ; Tue, 28 Oct 2008 07:01:50 -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 :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=9xwwFn9j/b81kgHcmByjHxHCPp07MOd+z5PlqgLjLto=; b=xxCCms4AGk1yYwY6JhHujvricwUKVUa0z4y6Fl2EnnZ5MRkqv/AYpe+P4jHiXvh6Nu CXmYahLhUMGBhbeXymZotji0NAOvzZQ0aUbmgHxTYzxGRYqxEiwB6KWoLLCsBZGojEH+ LI9e1tR0NUePIdxsXygDoAu8PKoUEB2bXlvcY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=EWRNyYh81UXksqukL/ExmRmJ+w1NTt8GqRhJZrnXUc5RrfbSh9+xmL3TceSVkf0e5A 6zqO++gfLxqoUnyu6fJZ1LTKLofiSsysCH7aCjXabolqrrV9ZDCtijlykDvEtWbME6wN n/9iflz8JAmS0cR0xcCxXss0nEg6on/bB8XkI= Received: by 10.103.168.5 with SMTP id v5mr3416039muo.86.1225202510592; Tue, 28 Oct 2008 07:01:50 -0700 (PDT) Received: from ?10.0.0.187? (mail.cmbtravel.ro [84.234.105.22]) by mx.google.com with ESMTPS id i5sm5798008mue.11.2008.10.28.07.01.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Oct 2008 07:01:49 -0700 (PDT) Message-ID: <49071AF4.6080908@gmail.com> Date: Tue, 28 Oct 2008 16:00:20 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b1pre) Gecko/20081006 Shredder/3.0a3 MIME-Version: 1.0 To: Lars Strojny CC: Andrei Zmievski , =?UTF-8?B?Sm9oYW5uZXMgU2NobMO8?= =?UTF-8?B?dGVy?= , Alexey Zakhlestin , Mark van der Velden , Stanislav Malyshev , PHP Internals 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> In-Reply-To: <1225199800.878.0.camel@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] array_key_exists BC break From: ionut.g.stan@gmail.com (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 }); 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 >