Re: [RFC] Type hints
| From: | Jason Garber | Date: | Mon, 10 May 2004 15:31:38 +0000 |
| Subject: | Re: [RFC] Type hints | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9795@lists.php.net to get a copy of this message | ||
Hello,
I've been following this discussion from the beginning. To be pointed, I think that the whole matter is rather a serious case of "overfunctionality".
Consider allowing a type hint such as
function foo(MyClass $bar)
The only way I see that as being useful is to be able to assume that you
can safely say $bar->DoSomething() from within your function WITHOUT FIRST HAVING TO write an if() statement that verifies that it is not null.Even allowing null as a default parameter is somewhat disturbing. The programmer should ditch the typehint if he needs any behavior other than the one described above, and use a simple if() statement to find out if it is the correct class. If it is deemed necessary to allow a NULL default parameter, then let's keep it simple - function foo(MyClass $bar = NULL) IMHO, PHP has always been a language that can be used very simply, but still has the low-level power to accommodate all the other things that one wishes to accomplish. Let's keep it that way. __________________________________________________________ Jason Garber President & Chief Technology Officer IonZoft, Inc. 814.742.8030 :: jason@ionzoft.com :: http://IonZoft.com __________________________________________________________