Sebastian Bergmann wrote:
  Named parameters are commonly implemented using an associated array in
  PHP:

    <?php
    function foo($parameters) {}

    foo(
      array(
        'foo' => 'bar',
        'bar' => 'foo'
      )
    );
    ?>

So, how do you think that isn't known to the original poster as he even explicitely states that he wants to remove the need for array()?


> I was also thinking of proposing named parameters, i.e. basically
> removing the need for array() in foo(array('style' => 'hot', 'size' =>
> 42)); but I guess that'll be even more controversial

Also, notice that there is quite a disctinction between keyword/named parameters and passing an associated array to the function - in the former case, several optimizations could be implemented at "compile time" (what is the correct term for this in the PHP model?); in your (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.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to