Hello All,

IMHO. I agree with Andi, but the only way to I see fit to implement this is
through polymorphism. If every object is a subclass of an Object class then
passing a NULL reference would make more since and be perfectly legal.

-Justin Hannus


"Andi Gutmans" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
At 11:03 PM 9/6/2003 +0200, Marcus Börger wrote:
> > What needs to be discussed ? Typehinting works with NULL values (It's
> > working for me), or am I wrong?
>
>The point was that it doesn't make sense for values passed by reference and
>that maybe someone doesn't want to allow NULL which is IMO the normal case.
>Because with type hinting you say you want an instance of a certain class
>and you didn't say something about NULL. The idea was then to allow NULL
>only if that's the default value.

I think that there is no right way. What I would like to see is:
a) Type hints allow the type and null (in objects),  i.e. method(MyClass
$obj)
b) Add an option of writing "not null" to make the type hint not allow
null. i.e. method(MyClass $obj not null)

Andi

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

Reply via email to