Re: Silent Types
| From: | Andreas Hennings | Date: | Wed, 04 Sep 2019 17:17:55 +0000 |
| Subject: | Re: Silent Types | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-106859@lists.php.net to get a copy of this message | ||
On Wed, 4 Sep 2019 at 09:22, Lynn <kjarli@gmail.com> wrote:
>
> Note that this behavior would require making some decisions whether or not
> in the future this opt-in behavior should change when a default value is
> given, such as with C# and type inference when declaring a variable, based
> on its assigned value.
I think this would too easily lead to mistakes.
E.g. if in a git commit, "$x = 5.6;" is replaced with "$x = 5;" or "$x
= '5.6';", then would a reviewer notice that this implicitly changes
the type?
Also, what if the initialization is inside an if branch? Later the
if/else gets reordered, or one of the conditional branches gets
removed, and the variable changes its type?