Re: [RFC] Basic Scalar Types
| From: | Lester Caine | Date: | Sun, 15 Mar 2015 22:33:42 +0000 |
| Subject: | Re: [RFC] Basic Scalar Types | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-84946@lists.php.net to get a copy of this message | ||
On 15/03/15 18:16, Niklas Keller wrote:
>> I think allowing
null for an
>> int is an error. Converting a null to
>> > zero on a type boundary is harmful in my opinion.
> I agree, null shouldn't be allowed for
> int.
That a database result set will have perfectly valid 'null' returns for
fields is perfectly normal practice. Even if with a full record those
fields would have numeric counts of say invoices for a period. Treating
the field as a '0' may be valid in some cases, but equally handling a
null return is valid.
While off topic here, very closely related is returning a 'null' object
when there are no return values. Now converting that to an exception is
simply wrong from a normal data flow process. null has a specific
function and value.
--
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
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk