Andrea Faulds wrote on 14/01/2015 13:15:
Hi Thomas,
On 14 Jan 2015, at 13:04, Thomas Nunninger <tho...@nunninger.info> wrote:
Sorry, if my mail was not clear. My point was: If I write a library in strict
mode and someone else is using it from his non-strict mode, he can pass an
integer to myFunc() without an error. If I use this integer in my library and
hand it over to otherFunc() (in my library) this will fail as integer is not
accepted for float.
Or did I misunderstood the RFC and there is a casting of the integer to a float
when calling myFunc()?
The value would be casted, yes. From the function author’s perspective, there’s
no need to worry about strict vs. weak typing: in both cases, you get the type
you asked for.
Perhaps it would be clearer if the RFC (and the documentation, if this
is accepted) referred to the non-strict as something other than "weak".
It makes it sound like only a weak check will be performed, and some
values of the "wrong" type will be allowed through, when in reality you
will always get exactly the type asked for.
Maybe "coercive type-checking" would more accurately reflect the
functionality?
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php