News for hackers. Stuff that matters.
Re:Everything you need (and don't need) to know about PHP's ... by wolco on Sunday July 26, 2020 @05:41AM (#23955754)
Main takeaway: strict types won't make your code faster!

It may make it slightly slower

Re:Everything you need (and don't need) to know about PHP's ... by fennecfoxen on Sunday July 26, 2020 @07:57AM (#23956420)
The point of strict types is generally not speed, but rather, to make your code more correct.
Re:Everything you need (and don't need) to know about PHP's ... by chiefalchemist on Sunday July 26, 2020 @08:56AM (#23956736)
Correct? I'd probably say predictable.
Re:Everything you need (and don't need) to know about PHP's ... by fennecfoxen on Sunday July 26, 2020 @09:29AM (#23956913)
Eh. If MyPy complains that I'm passing an `Optional[Entity]` into a method where only an `Entity` can go, it's just helped me avoid a runtime error when I try to get `entity.name`. Not sure what the exact PHP equivalent is, but there's all sorts of bugs you can easily introduce if you're not careful with types.
Re:Everything you need (and don't need) to know about PHP's ... by wolco on Sunday July 26, 2020 @04:27PM (#23959930)
PHP doesn't compile so all errors become runtime errors.
Re:Everything you need (and don't need) to know about PHP's ... by nawarian on Tuesday July 28, 2020 @06:13AM (#23974164)
Small correction: php IS compiled, just not the way we're used with the term. See https://thephp.website/en/issue/php-8-jit/ for more information.

The answers below show a good solution for this issue: use static analysis tools in build time and potentially even as a pre-commit hook.

Re:Everything you need (and don't need) to know about PHP's ... by fennecfoxen on Sunday July 26, 2020 @07:00PM (#23960824)
It is nice that you are trying to inform me but I am already aware of the information that you bring and your decision to bring it makes it seem to me as if you are uninformed. It is possible to conduct static analysis of a source code file that is not "compilation" in the sense that you would otherwise see with Java or C. Python's not really any different than PHP in this regard.
Re:Everything you need (and don't need) to know about PHP's ... by stunt on Monday July 27, 2020 @06:26AM (#23963755)
Yeah but should use static analysis tools in your CI/CD and development workflow when using an interpreted language. That's a must have.

So better typing can definitely help to catch those before pushing and running your code.