4 ms·
It’s a different language. Different enough to warrant a different name, at the very least. PHP has been able to add in more typing over the same period of ti
by mgkimsal 3y ago
It’s a different language. Different enough to warrant a different name, at the very least.
PHP has been able to add in more typing over the same period of time and has seemed to avoid these Python problems.
- bruce343434 3y agoI'm pretty sure that php has also explicitly broken backwards compatibility to achieve this. In general php has become far more strict over the years, which I think is a good thing. And they definitely at least sat down and thought about how to do types before adding grammar rules that allowed any random expression as the type, which is now the case in python.
- mgkimsal 3y agoThe backwards compatibility has broken some - I think mostly visibly noticeable between 5.6 and 7.0. And every release there's some deprecations introduced that will eventually break in future. Many complex applications in 5.6 won't run 100% error free in 8.2, for sure. I'm working with a company to move from 5.6 to 7.4 and there's very little that doesn't work in the main code. Their earlier version of Doctrine was using a class called 'Null', and internally (unrelated to doctrine) they had a class named 'Null' - those had to be renamed. That took all of about 2 minutes. Upgrading Doctrine version got us to a version that removed the Null class name there too. Python also broke backwards compatibility with their v3 release years ago. Unsure why breaking backward compatibility is being called out here(?). But yeah, overall, it's struck me that PHP has introduced more and stricter typing rules with surprisingly little impact (compared to what could have been, of course).
- n6242 3y agoI've had to work on a PHP project recently and it's horrible. Mypy has many pitfalls and it's not great, but at least it's entirely optional, so you can work around the issues or ignore some types until you can fix it or do some refactoring. Typescript might be a different language but it's the best implementation of adding types to a language I've seen so far.
- mgkimsal 3y ago> I've had to work on a PHP project recently and it's horrible. Mypy has many pitfalls and it's not great, but at least it's entirely optional... Do you mean mypy is optional? At the risk of opening a can of worms here, what's "horrible"? In your own PHP code, you can get by without any typing at all. If/when you start to use 3rd party libraries, that may become a factor, though off the top of my head I can't think of a show stopper.