On Thu, Dec 22, 2011 at 06:08:26PM -0500, Will Fitch wrote:

> Most modern languages allow returning null in any case. This is a hail
> Mary in the event something happens, but throwing an exception is
> inappropriate. I see no reason to diverge from that.

Agreed, it is often convenient to return NULL or FALSE to indicate failure
or something like end of input (think: fgetc()). I was mulling syntax like:

    function (string|boolean:false) fgetc(resource $handle)

Then the compiler would know that after:

    if( ($ch = fgetc($in)) === FALSE)
        return;

that $ch is string ... but seems too complicated.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

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

Reply via email to