On 15/01/15 08:49, Pavel Kouřil wrote:
>> One of the nice features of PHP when I started using it all those years
>> > ago was that I did not have to create separate functions different types
>> > did exist in the source data. int/float/num/double and others all needed
>> > separate handling in c/c++, and one could not easily add a different
>> > 'type' of data.
>> >
> If you have a function which requires a "double" in C# (a strongly
> typed language), you can safely pass int to the function and it will
> work, because you are not narrowing the possible values. So making the
> PHP accept only the argument if its type is exactly the same as the
> parameter (paraphrased from RFC for the strict version of type hints)
> seems like a step in a wrong direction. If I'm not mistaken, Java
> behaves the same way. How exactly does it work in C++ and C? I haven't
> used C in years, so I'm a little bit rusty on this detail.

I'm going back 15 years here ;)
I still have code with several functions which are essentially the same
because they wrap the same core function, but on moving to PHP all the
wrappers fall away and one just adds the 'conversion/validation' in the
function. e_strict has already brought back the need for extra versions
of functions for static and dynamic access and adding typing potentially
extends that.

-- 
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

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

Reply via email to