Re: Re: internals Digest 24 Oct 2003 20:08:45 -0000 Issue 194

From: Date: Fri, 24 Oct 2003 21:48:00 +0000
Subject: Re: Re: internals Digest 24 Oct 2003 20:08:45 -0000 Issue 194
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-4976@lists.php.net to get a copy of this message
We have had discussions about named parameters in the past. They won't be supported for PHP 5. In any case, even if they are supported by the engine they will still be very inefficient and will just bloat PHP. Most languages do without them and I think PHP can do so too. Andi At 11:13 PM 10/24/2003 +0200, Christian Schneider wrote:
Michael Walter wrote:
(the common) way of faking named parameters, you rely on a) hash lookups at execution time (for _every_ call) and b) on manually dealing with default values.
I'd even be happy to accept these two drawbacks but the ugliness of the array() solution is what I'd like to get rid of. Something like either foo('x' => 'x-value', 'y' => 'y-value); or foo($x => 'x-value', $y => 'y-value'); or foo(x:'x-value', y:'y-value'); or a mix of one of these solutions would be really handy in writing readable code. One thing which would make it really powerful for my purpose would be if I don't have to declare all possible parameters to my function, i.e. a way for foo() to find out what arguments were passed to it (name and value). Something like treating the whole parameter list as an array definition so that (using the first of the above syntax versions) foo('x' => 'x-value', 'y' => 'y-value', 'z-value'); would basically be the same as foo(array('x' => 'x-value', 'y' => 'y-value', 'z-value')); but more readable (and writable). I think of the parameter list as a kind of an array anyway, that's why I think both array()-less named parameters and dangling comma at the end should be allowed. - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#4976) next »