Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41540 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97715 invoked from network); 28 Oct 2008 22:31:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Oct 2008 22:31:53 -0000 Authentication-Results: pb1.pair.com header.from=ionut.g.stan@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ionut.g.stan@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.182.190 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: 64.233.182.190 nf-out-0910.google.com Received: from [64.233.182.190] ([64.233.182.190:20019] helo=nf-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/39-48169-7D297094 for ; Tue, 28 Oct 2008 17:31:52 -0500 Received: by nf-out-0910.google.com with SMTP id b11so1166133nfh.13 for ; Tue, 28 Oct 2008 15:31:48 -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:references; bh=wIqOU0OuDO+tMHl+XoRPFAdycXJixCy+45XhKk/9oJg=; b=lmoIZXgovvzsnJEUrkjpjLmi9x4Ajmwas5GE8docSDsoA4w48nCk3Uez/dOEjq9H0N SG9uHpaQX+mStwiWyRf/SNwDJIO9rJUEAsZBd/2T3VJn77F6nVK7Q9RLrVd4vi6M3/dc 4WZtWUAQiaHQEzxLvxnu3bdcq/hkFvCICFV0s= 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:references; b=vC6doN34Trrbtjuuyt79DCK0djgIauV0vRKcfG3L4lh7H0XeqUBlvjVs6vcAr+awtF /mK6yC9dTBG16LpKE9P6IAd570hAwhqJhSHCqtUjHVd8CniGlcYtO8A9fUFuL8PyptNy TrJTe5zRsF/WuZ90bp9sryQmn32T7FHtesac0= Received: by 10.210.104.20 with SMTP id b20mr9061828ebc.20.1225233108155; Tue, 28 Oct 2008 15:31:48 -0700 (PDT) Received: by 10.210.10.4 with HTTP; Tue, 28 Oct 2008 15:31:48 -0700 (PDT) Message-ID: Date: Wed, 29 Oct 2008 00:31:48 +0200 To: "Kalle Sommer Nielsen" 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: <2dedb8a0810280723m2f021a5bsc1850249ebdd4fc9@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_61803_24164917.1225233108140" 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> <2dedb8a0810280723m2f021a5bsc1850249ebdd4fc9@mail.gmail.com> Subject: Re: [PHP-DEV] array_key_exists BC break From: ionut.g.stan@gmail.com ("Ionut Gabriel Stan") ------=_Part_61803_24164917.1225233108140 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Thanks for your positive feedback about my idea and sorry for hijacking this thread. Although my C skills are limited to its syntax only I'll create an RFC, then someone else might give it a try an create a patch. All the best, Ionut On Tue, Oct 28, 2008 at 4:23 PM, Kalle Sommer Nielsen wrote: > 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: > > class Test > { > public function hello($who) > { > echo 'Hello ' . $who; > } > } > > $closure = function() > { > static $instance; > > if(!$instance) > { > $instance = new Test; > } > > return($instance); > }; > > $closure->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 > ------=_Part_61803_24164917.1225233108140--