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

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



Reply via email to