On Fri, Apr 29, 2011 at 02:38:31AM +1000, Ben Schmidt wrote:
> I also see the value of such type checking for such a use case, obviously.
>
> I guess there's a reason for it after all.
>
> I'd still like to see something neat to handle more than just named
> classes, though, e.g. scalars, and things like "false on error" for return
> values.
That is why I suggested, in addition to the above, a syntax like:
function (Foo | NULL) foo($something) {
to be able to specify where a function can return more than one type.
The 'extra' types/values are nearly always either NULL or FALSE.
I agree that being able to specify as types: array, scalar, int, string, ...
would be useful for a compiler but prob have little value for Zend - other than
documentation/reflection.
--
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