Hi Rowan,
Rowan Collins wrote:
> Andrea Faulds wrote on 15/10/2015 17:34:
>> Hi Pedro,
>>
>> Pedro Cordeiro wrote:
>>> I've been thinking about what PHP should do when accessing the return
>>> value
>>> of a `void` function, and so far, I think the consistent thing should
>>> be to
>>> get NULL, while throwing an E_NOTICE.
>>
>> We could do this, but I do wonder if it might cause a lot of E_NOTICEs
>> to pop up for existing code, assuming we applied this to built-in PHP
>> functions.
>>
>> I'm not sure.
>
>
> The way Pedro described it, it wouldn't apply to any existing functions
> because they wouldn't be declared void.
>
> Obviously, type hints for internal functions are a bit weird anyway, but
> there's no reason to assume that every function documented as void would
> suddenly be annotated in the Engine as such and start returning notices.
Why shouldn't it? For the scalar types, internal and userland functions
behave almost the same.
I'd like there the two to converge, not diverge.
--
Andrea Faulds
http://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Rowan Collins wrote:
> Andrea Faulds wrote on 15/10/2015 17:34:
>> Hi Pedro,
>>
>> Pedro Cordeiro wrote:
>>> I've been thinking about what PHP should do when accessing the return
>>> value
>>> of a `void` function, and so far, I think the consistent thing should
>>> be to
>>> get NULL, while throwing an E_NOTICE.
>>
>> We could do this, but I do wonder if it might cause a lot of E_NOTICEs
>> to pop up for existing code, assuming we applied this to built-in PHP
>> functions.
>>
>> I'm not sure.
>
>
> The way Pedro described it, it wouldn't apply to any existing functions
> because they wouldn't be declared void.
>
> Obviously, type hints for internal functions are a bit weird anyway, but
> there's no reason to assume that every function documented as void would
> suddenly be annotated in the Engine as such and start returning notices.
Why shouldn't it? For the scalar types, internal and userland functions
behave almost the same.
I'd like there the two to converge, not diverge.
--
Andrea Faulds
http://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php