On 08/02/17 14:54, Michał Brzuchalski wrote:
> 2017-02-08 12:51 GMT+01:00 Michael Wallner <m...@php.net>:
> 
>>
>> ```
>> // https://github.com/m6w6/ext-psi#implementations
>> function math\add(int $a, int $b) : int {
>>         let a = intval($a);
>>         let b = intval($b);
>>         return to_int(add);
>> }
>> ```
>>
> 
> What is the purpose of `intval` call if both variables were declared as int
> already?
> Also what to_int stands for if we already declared int return type?
> 

While those type casts might seem superfluous for simple functions,
marshalling between PHP and C quickly becomes complicated and requiring
explicit casts just reduces the possibility of tripping points even if
the types match on both sides. Omitting them wouldn't change anything
internally, but just bloat the parser.

-- 
Regards,
Mike

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to