Hello Cristiano,

Wednesday, October 27, 2004, 2:21:03 AM, you wrote:

> So reading all posts on this subject, the proposal would be:

> 1) Allow null typehints
>  public function Compare([BaseClass] $objA, $cmpFunc);

see below.

> 2) Don't allow null typehints
>  public function Compare(BaseClass $objA, $cmpFunc);

>  Ex: Compare(new BaseClass(), 'func1');

> 3) Optional argument (with typehint)
>  public function Compare($cmpFunc, BaseClass $objA=null);

This is no option because BaseClass typehint doesn't allow null and if
we have a dedicated syntax for default values we don't need this.

If at all this would be:
4) public function Compare($cmpFunc, [BaseClass] $objA=null);

But first we need to know if we really want to allow passing null
with default typehinted values. Since there is no concept of null
references in PHP. Having a value of null to mark not passed is
a nice differentiation.

So for now the only addition we may probably consider for 5.1 is
adding 4: optional typehinted values that default to null and only
null.

marcus

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

Reply via email to