Re: [RFC] Type hints
| From: | Hans Lellelid | Date: | Tue, 11 May 2004 13:37:31 +0000 |
| Subject: | Re: [RFC] Type hints | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9815@lists.php.net to get a copy of this message | ||
Hi,
Timm Friebe wrote:
Jason, I know how to build a workaround; but this is just kludgy. Marcus complained in his original mail that he was "annoyed" by the fact of having to check on a type-hinted parameter being NULL. How about I suggest I'm annoyed about having to check non-type-hinted parameters in the way you suggested above?+++1! Probably 50% of the classhints I use are for optional parameters. To lose this will mean losing 50% of my typehints. I don't think it's a pain to check non-null for optional params. For non-optional params I probably wouldn't check for non-NULL in most cases, anyway. If a value expects an object and is passed NULL then I'm fine with it breaking in an ugly E_FATAL way. I would add what I feel is an important point: PHP5's use of interfaces and abstract classes has brought an increased strictness to PHP OO. I think everyone is happy with these language features, but I think it's fair to say that these features are going to result in a much greater use of optional params -- in order to satisfy interface requirements but allow classes to have more flexible signatures. Thus, removing the ability to use class typehints on optional parameters will only become a larger problem than it is now. (and I think it's already a pretty big problem) Hans