Re: Return type hints

From: Date: Mon, 07 Apr 2008 17:39:42 +0000
Subject: Re: Return type hints
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-36855@lists.php.net to get a copy of this message
On 07.04.2008, at 18:57, Stanislav Malyshev wrote:
Hi!
I just ran into this (IMHO unnecessary) limitation with array_reduce: Why should it only reduce to an int? Why not a string or an array? I plan on submitting a patch for PHP 6 to allow other types too.
I'm not sure I understand - how array_reduce is related to having type hints? You could make array_reduce to do additional things, but that doesn't require introducing strong typing into php.
PHP should be as flexible about types as possible. I never used array_reduce() so I do not know its history. But some of you might remember the change in behavior from array_merge() which was the result of a switch to a more strict parameter parsing API, which now returns false when you pass in NULL. A fair amount of people believe that this is the wrong direction to take. Continuously expanding type hints relates to this concern. regards, Lukas

« previous php.internals (#36855) next »