Re: [RFC] Scalar Type Hints v0.2
| From: | Andrea Faulds | Date: | Thu, 15 Jan 2015 14:03:30 +0000 |
| Subject: | Re: [RFC] Scalar Type Hints v0.2 | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80536@lists.php.net to get a copy of this message | ||
Hi Stas,
> On 14 Jan 2015, at 23:29, Stanislav Malyshev <smalyshev@gmail.com> wrote:
>
> I agree. Being wrong is bad, making a mistake is bad, but having split
> personality language and not knowing in which world you are - or even
> worse, having to deal with both worlds in the same code and being thrown
> back and forth between them by some little switch which is easy to miss
> - IMO is worse. I don't like strict typing in PHP because I think it is
> contrary to the idea of how dynamic languages should work, but I'd
> rather have that then two sets of rules living within the same code,
> especially when looking at the function I can't even know how it would
> work without checking if there's a declare hiding somewhere. And
> refactoring becomes a nightmare - what if I moved function from strict
> world to non-strict world or vice versa?
It’s not about the location of the function, but the call site. You can place a function anywhere
and it will behave identically.
> I also agree with Dmitry in other thread - if some conv rules are so bad
> everybody hates them (or at least you think it is the case :), we can
> change them. We are already on that track with some weird ones like
> array->string. Even with BC effects, IMO better than too many sets of
> rules.
There are some minor issues with the conversion rules that could be fixed, but a lot of people have
a problem not just with the conversion rules, but with the implicit conversion itself. The previous
RFC (Scalar Type Hinting with Casts) wasn’t popular with many people for that reason: sure, it had
stricter rules, but that won’t please people who want no conversion whatsoever.
Thanks.
--
Andrea Faulds
http://ajf.me/