At 12:57 PM 5/9/2004 +0200, Derick Rethans wrote:
On Sun, 9 May 2004, Andi Gutmans wrote:

> I really would like to finalize this issue ASAP because it's the last
> *feature* I see for PHP 5.0. The main reason why I think we need to
> finalize it is because depending on the solution we choose, it would break
> BC if we fix it after 5.0.
> Consider the following options for a parameter with default value which
> allows null:
> MyClass $a or NULL = 5
> MyClass $a = 5 or NULL
> MyClass or NULL $a = 5
>
> I think all of these are pretty ugly and I don't feel comfortable with
> adding them to the language.
> The following (Zeev's idea) is much simpler and nicer, but I'm not 100%
> sure if this is the perfect solution:
> nullable MyClass $a = 5

null or MyClass $a = 5 ?

I don't like this. I think it's too long and ugly.


I've no idea what nullable is supposed to mean... (well, I do :)


I was also wondering if the following would also work:


class b extends a { }

function foo (a $obj) { }

$b = new b;
foo($b);

(ie, an inherited class also passes the hint check)

Yep. It's an instanceof check.


Andi

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



Reply via email to