Hartmut Holzgraefe wrote:
Ron Korving wrote:
Let me summarize it for you then.
Advantages of named parameters over associative arrays:
- cleaner syntax
- support for type hints
- difference between required and optional parameters
- generating documentation (whether with something like
Hartmut Holzgraefe wrote:
Brad Fisher wrote:
Thus no need to rework internal parameter passing API at all.
Perhaps I'm missing something?
you missed that the parameter name information is just not available
for internal functions, the api works by parameter positions only
right now, so
Lukas Smith wrote:
Our original idea was to handle this with an if statement like so:
if (version_compare(phpversion(), 5.0.0) == -1) {
// assign factoried method to this for PHP 4
// $this = Your_Package_Name::factory();
// $this = Your_Package_Name::singleton();
eval('$this =
Rasmus Lerdorf wrote:
I could see people doing:
class foo {
function foo() {
...constructor stuff...
}
function __construct() {
$this-foo();
}
}
I actually prefer it the other way around... foo would call __construct in
PHP4, and __construct would be
Ferdinand Beyer wrote:
On 17 Feb 2004 at 14:01, Brad Fisher wrote:
class D {
function bar() {
$c = new C;
// I'd like to call the A::foo method of C here...
//In PHP4, I could do something like:
Why should one want to do that? Why should PHP allow this?
For one
Ferdinand Beyer wrote:
On 18 Feb 2004 at 11:02, Brad Fisher wrote:
For one because PHP doesn't allow method overloading. If I have
a method
A::foo($a), and I want to change the prototype in B to B::foo($x,
$y), then
...snip...
(like C::A_foo) which then calls A::foo internally? I'd
incurring a performance penalty yet
again.
Any suggestions how this could be more efficient? Personally, I'd like
to see syntax directly in the engine to support this:
$c = new C;
$c-A::foo();
Though the static version C::A::foo() looks a little wierd
-Brad Fisher
--
PHP Internals - PHP
Personally, I both like and dislike this behavior. I like it for debugging
purposes, since it allows me full control over whether I ignore
error_reporting level or perhaps just log disabled levels instead of
displaying them, etc. On the other hand, there is a minor performance issue,
but if you