Re: Return Type Hinting for Methods RFC
| From: | Lester Caine | Date: | Thu, 22 Dec 2011 21:09:40 +0000 |
| Subject: | Re: Return Type Hinting for Methods RFC | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-57034@lists.php.net to get a copy of this message | ||
Dmitri Snytkine wrote:
While web isn't typed, the php is not just for the web anymore, or is it? Some databases expect typed input, else the data is not found. For example passing string '1' instead of number 1 will not cause any errors when searching MongoDB but you will not get the result you expect to get if the value of key is integer 1I think THIS is the ideal example on why we do not want to 'fix problems' in PHP just because something else does not work properly. If I pass a numeric value to a parameter in my database interface I do not worry about how that parameter was provided. I would treat the above example as a simply bug in MongoDB and is actually one of the reasons I have not bothered even looking at it as an alternative. If I am looking for an age do I want to limit people to 'years' ... 5 and a 1/2 is an acceptable age and may be generated automatically if I'm generating the data from a previously provided date of birth ... I prefer to provide errors myself when processing input like this, and that is always more appropriate IN the getter/setter that is handling the input. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php