Re: [RFC] Scalar Type Hints v0.2
| From: | Andrea Faulds | Date: | Wed, 14 Jan 2015 13:15:07 +0000 |
| Subject: | Re: [RFC] Scalar Type Hints v0.2 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80460@lists.php.net to get a copy of this message | ||
Hi Thomas,
> On 14 Jan 2015, at 13:04, Thomas Nunninger <thomas@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.
Thanks.
--
Andrea Faulds
http://ajf.me/