Re: type hinting
| From: | Robert Cummings | Date: | Mon, 07 Jan 2008 19:09:38 +0000 |
| Subject: | Re: type hinting | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-34596@lists.php.net to get a copy of this message | ||
On Mon, 2008-01-07 at 19:45 +0100, Stefan Priebsch wrote:
> Robert Cummings schrieb:
> > The onus should be on consumers of my API to use it properly, not on me
> > to jump through hoops to make sure they gave me the correct data at
> > every step of the way. I stopped holding hands in grade 3 or so.
>
> Still you force any defensive coder to repeat explicit type checks and
> type casts all over whenever one of your API functions is called.
That depends. If you look back in time at the messages on the list
you'll see I argue for the use primarily within libraries/frameworks and
not so much for general user consumption. For instance, if you extend a
class in my API and override methods and such, I expect the data you
pass to me is of the correct type when you call parent::someMethod().
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................