Re: [PHP-DEV] List comprehensions and generator expressions for PHP

2012-06-28 Thread David Muir
On 28/06/12 23:45, Sebastian Krebs wrote: > Hi, > > 2012/6/28 David Muir > >> I'd assume that array_map() only works with arrays, while list >> comprehension should work with anything traversable. >> > That sounds more like a "bug" (better: "Missing feature") in array_map() > and less a missing la

Re: [PHP-DEV] Re:[PHP-DEV] List comprehens​ions and generator expression​s for PHP

2012-06-28 Thread David Muir
On 29/06/12 14:06, minwei zhou wrote: > On Thu, Jun 28, 2012 at 6:48 PM, Nikita Popov wrote: >> Hi internals! >> >> Python and several other languages include support for list >> comprehensions and generator expressions and I'd like to see something > why PHP should going to like other language?

[PHP-DEV] Re:[PHP-DEV] List comprehens​ions and generator expression​s for PHP

2012-06-28 Thread minwei zhou
On Thu, Jun 28, 2012 at 6:48 PM, Nikita Popov wrote: > Hi internals! > > Python and several other languages include support for list > comprehensions and generator expressions and I'd like to see something why PHP should going to like other language? > similar in PHP too. > > I created a hacky pr

Re: [PHP-DEV] [DRAFT RFC] Adding Simplified Password Hashing API

2012-06-28 Thread Anthony Ferrara
Johannes, > I haven't looked at your patch. But if it has to call another > PHP_FuNCTION then it's not good. crypt implementation should be > accessible via C. I've refactored crypt() slightly to expose a PHP_API crypt_execute() function that does just about everything except the argument parsing

Re: [PHP-DEV] json_encode() behavior for incorrectly encoded strings

2012-06-28 Thread Nikita Popov
On Wed, Jun 27, 2012 at 2:19 PM, Nikita Popov wrote: > I looked at a few other error functions (of which we by the way we > have *loads*, which is a bad sign) and indeed it seems that they all > use a separate function to get the error message. Most use a > xyz_errno() + xyz_error() pair. > > So i

Re: [PHP-DEV] List comprehensions and generator expressions for PHP

2012-06-28 Thread Nikita Popov
> No mention of yielding keys in the comprehensions. Presume that would > work? Yup, that works too. I also included an example in the mail: $firstNames = [foreach ($users as $user) yield $user->id => $user->firstName]; This creates a map from ids to first names. > The simplest example I cou

Re: [PHP-DEV] List comprehensions and generator expressions for PHP

2012-06-28 Thread Nikita Popov
On Thu, Jun 28, 2012 at 2:43 PM, Sebastian Krebs wrote: > Hi, > > Whats the difference to the (already existing) function array_map() (except > the syntax and one more new keyword)? > >> $firstNames = array_map(function($user){return $user->firstname;}, > $users); > > Don't want to rewrite every e

[PHP-DEV] [PATCH] Feature 55218 - SimpleXML namespaces

2012-06-28 Thread Lonny Kapelushnik
Currently, if you recursively call getDocNamespaces on any SimpleXML node it retrieves ALL the namespaces for the entire document, regardless of what node you call it on. This patch adds a second bool argument called `from_root` that allows you to specify if you want all the namespaces from the roo

Re: [PHP-DEV] Resume keyword

2012-06-28 Thread Tom Boutell
Saying that "the exception handler shouldn't have called resume" in the case where the exception was originally thrown in a deeper stack frame sounds good until you consider that this requires exception handlers to know whether the code preceding them has been refactored or not, which makes it toug

Re: [PHP-DEV] List comprehensions and generator expressions for PHP

2012-06-28 Thread Sebastian Krebs
Hi, 2012/6/28 David Muir > I'd assume that array_map() only works with arrays, while list > comprehension should work with anything traversable. > That sounds more like a "bug" (better: "Missing feature") in array_map() and less a missing language feature... Regards, Sebastian > > David >

RE: [PHP-DEV] List comprehensions and generator expressions for PHP

2012-06-28 Thread Jared Williams
> -Original Message- > From: Nikita Popov [mailto:nikita@gmail.com] > Sent: 28 June 2012 11:49 > To: PHP internals > Subject: [PHP-DEV] List comprehensions and generator > expressions for PHP > > Hi internals! > > Python and several other languages include support for list > comp

Re: [PHP-DEV] List comprehensions and generator expressions for PHP

2012-06-28 Thread David Muir
I'd assume that array_map() only works with arrays, while list comprehension should work with anything traversable. David On 28/06/2012, at 10:43 PM, Sebastian Krebs wrote: > Hi, > > Whats the difference to the (already existing) function array_map() (except > the syntax and one more new key

Re: [PHP-DEV] List comprehensions and generator expressions for PHP

2012-06-28 Thread Sebastian Krebs
Hi, Whats the difference to the (already existing) function array_map() (except the syntax and one more new keyword)? > $firstNames = array_map(function($user){return $user->firstname;}, $users); Don't want to rewrite every example you gave, but you probably see my point. Regards, Sebastian 20

Re: [PHP-DEV] List comprehensions and generator expressions for PHP

2012-06-28 Thread Jordi Boggiano
Heya, > So, what do you think? Do we want something like this in PHP? I think it looks great, especially the generator functions would be useful to avoid having to create a full blown iterator for simple stuff. Cheers -- Jordi Boggiano @seldaek - http://nelm.io/jordi -- PHP Internals - PHP

[PHP-DEV] List comprehensions and generator expressions for PHP

2012-06-28 Thread Nikita Popov
Hi internals! Python and several other languages include support for list comprehensions and generator expressions and I'd like to see something similar in PHP too. I created a hacky proof of concept implementation here: https://github.com/nikic/php-src/tree/addListComprehensions. It's really dir

Re: [PHP-DEV] [PATCH - PR] Disable ATTR_EMULATE_PREPARES by default for PDO_Mysql

2012-06-28 Thread Yasuo Ohgaki
Hi, 2012/6/28 Rasmus Lerdorf : > On 06/27/2012 08:45 PM, Yasuo Ohgaki wrote: >> Hi, >> >> I forgot to mention MySQL's query cache. >> This change may have negative performance impact, since prepared >> query is not cached and native prepared query may not be used by >> other requests. > > That's n

Re: [PHP-DEV] RFC: Property get/set syntax

2012-06-28 Thread Benjamin Eberlei
What is the state here with regard to merge into php-src? On Sun, Apr 22, 2012 at 5:48 AM, Clint M Priest wrote: > > > > -Original Message- > > From: Stas Malyshev [mailto:smalys...@sugarcrm.com] > > Sent: Saturday, April 21, 2012 10:33 PM > > To: Clint M Priest > > Cc: internals@lists.p

Re: [PHP-DEV] [DRAFT RFC] Adding Simplified Password Hashing API

2012-06-28 Thread Johannes Schlüter
On Wed, 2012-06-27 at 22:00 -0400, Anthony Ferrara wrote: > Johannes, > > > Some comments on the "error behavior" part: > > > >E_WARNING - When CRYPT is not included in core (was disabled > >compile-time, or is listed in disabled_functions declaration) > > > > Disabling a different functio

Re: [PHP-DEV] [DRAFT RFC] Adding Simplified Password Hashing API

2012-06-28 Thread Pierre Joye
Hi Anthony! On Thu, Jun 28, 2012 at 4:00 AM, Anthony Ferrara wrote: > Hrm. Well, then I guess I could re-implement against crypt internally. > That would take either a slight re-implementation of the crypt() > internals, or slight refactoring of the PHP_FUNCTION(crypt) function > to enable c cal