I like the type hinting changes, but I have to say that chasing after Java is a bad idea in my opinion. If you want to do Java programming, go do Java programming. PHP is its own thing, and it doesn't need to become Java with dollar signs. I never want strict typing to become mandatory in all my code. At that point I might as well write Java.
Joseluis Laso - 2015-03-23 14:13:08 - In reply to message 1 from Joeri Sebrechts
Thanks for your comments. I'm not programming in Java at professional level, but I learned with java and I recognize that is better to have function return types that not.
In your case, you are totally free to continue using the old system, simply don't use the new declaration. But, as natural language, PHP is moved by the community and reflecting the changes that it proposes.
Joeri Sebrechts - 2015-03-23 16:08:52 - In reply to message 2 from Joseluis Laso
I think you misunderstood what I meant. I meant that I like this specific set of changes, with the return types and primitive types and optional strict type checking. I'm in favor of having the ability to optionally use strict typing where it matters.
My remark is more towards the general principle that "java does it, therefore we should do it too", which I don't think is a good principle to go by.
Jeff - 2015-03-23 19:46:34 - In reply to message 3 from Joeri Sebrechts
Well if you think about it also C, C++, C#, Visual Basic, D and many other languages does it. It isn't something that only Java does, there was a funny post saying that PHP is becoming more like Java but that isn't the case. Type hinting, besides more secure and self documented code, is a way to make optimizations that are hard to deduce on an untyped language.
Yes, nodejs does optimizations without type hinting but take a look at how much resources it uses for that.
Rafael den Heijer - 2015-03-24 13:01:09 - In reply to message 1 from Joeri Sebrechts
Strong typing is actually very much preferred, especially when dealing with in- and output. But there are cases in which the in- or output can or should be different depending on when you're calling it. In short: It CAN'T become totally strong typed, because that would simply ntot work in php's architecture...