Re: Type hints with null default values

From: Date: Sat, 16 Oct 2004 21:24:59 +0000
Subject: Re: Type hints with null default values
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-13350@lists.php.net to get a copy of this message
Cristiano Duarte wrote:
Now that 5.0.3 is out, maybe it's time to bring back that old problem left in May: type hints and null default values. This feature was dropped since no one could come with a reasonable solution. So, for now, there is no (engine) way to have a parameter that can only be of some class or null. Am I right ? The use of null (I know it's not a value it's a type...) is justified because we don't have a "value" to represent a NULL OBJECT(or NO OBJECT). IMO, this is a necessary feature (maybe others thing this way too) and that's why I brought it back.
I'm also realing waiting for this implemented. Since I've started to use the new features of v5, I've had to deal with parameter checks in exactly this way. If it's not class/interface instanceof type x, throw an exception. I just hope, if it gets implemented, it's done via exceptions too. - Markus

« previous php.internals (#13350) next »