Re: Type hints with null default values

From: Date: Mon, 07 Feb 2005 20:40:49 +0000
Subject: Re: Type hints with null default values
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-14699@lists.php.net to get a copy of this message
What was the result of this discussion? Thanks On 27 Oct 2004, at 12:50, Andi Gutmans wrote:
At 10:53 AM 10/27/2004 +0200, Christian Schneider wrote:
Marcus Boerger wrote:
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.
Please don't add another parameter syntax (especially with line-noi... err special characters) like [BaseClass]. This would make PHP more unreadable than it needs to be for a minor feature. To allow foo(BaseClass $objA = null) to also accept foo(null); handles the few cases where you want to pass null nicely IMHO. Advocating to only change the PHP syntax to simplify it,
Yeah I tend to agree. Adding [] for a not that popular case seems not to be worth it. It just adds more complexity to the syntax. I suggest to either leave as is or to support default values of NULL (only) and if that is given then you may also pass NULL (give it a double meaning).


« previous php.internals (#14699) next »