well, i personally dont care, php as not strictly typed language curently is not ready for this. imho.
ps: in last snippet you have syntax error. :P :)
But we are slowly heading in that direction, far too slowly really. Strict types help you code better and stop of lot of issues that can take time to debug.
PHP 7 made some headway here with strict_types, if you don't want it don't set it to true, or just leave out your type hints altogether - very sloppy!
Personaly I'd love to have fixed types for variables:
Yes, all those Ruby and Smalltalk developers are producing completely unusable garbage because they lack manifest typing. /s
I like PHP's dynamic loose scripting nature. If you want that more verbose kind of thing, there is Java, or Swift, or whatever.
PHP's current nature fulfills a unique niche in my toolkit and I like it the way it is (although I'm all for consistent naming and moving to a more dynamic OO style).
Maybe I'm missing something, but isn't how JavaScript does it with .reduce, .map, .split etc... practically what the suggested improvement wants? And JS doesn't enforce types either, right?
well, i personally dont care, php as not strictly typed language curently is not ready for this. imho.
ps: in last snippet you have syntax error. :P :)
But we are slowly heading in that direction, far too slowly really. Strict types help you code better and stop of lot of issues that can take time to debug.
PHP 7 made some headway here with strict_types, if you don't want it don't set it to true, or just leave out your type hints altogether - very sloppy!
Personaly I'd love to have fixed types for variables:
Or even better without the annoying $ prefix which does nothing IMHO:
Yes, all those Ruby and Smalltalk developers are producing completely unusable garbage because they lack manifest typing. /s
I like PHP's dynamic loose scripting nature. If you want that more verbose kind of thing, there is Java, or Swift, or whatever.
PHP's current nature fulfills a unique niche in my toolkit and I like it the way it is (although I'm all for consistent naming and moving to a more dynamic OO style).
Mind expanding your point here? What does type safety has to do with scalar objects?
I mean, when type is not enforced, scalar object can have different methods depending on current type. Or am I wrong?
Maybe I'm missing something, but isn't how JavaScript does it with
.reduce
,.map
,.split
etc... practically what the suggested improvement wants? And JS doesn't enforce types either, right?Yep, and it would just require an extra step sometimes to explicitly cast to the desired type. We have to do this in PHP/JS sometimes now as it is.
It could be usable tho... i imagine this: