Hacker News new | ask | show | jobs
by mgkimsal 1191 days ago
I've been in PHP for a long time, and over the last 8-10 years there's been a push for more typing in the language, and we have a lot more typing ceremony than earlier PHP. The nice aspect is that you can get away without it, at least for a while, and add in later. By later I'm usually meaning minutes or hours, not months. :) Biggest example I can provide right now is writing a class method - I don't have to put a return type on a method (indeed, you couldn't in earlier PHP!). When I'm first writing a method, I don't always necessarily know how I might use it. I can write up something basic, then decide after testing/experimenting that I want the return type to be a float, not an integer.

Did this in Groovy as well for a few years - not being required to declare a bunch of stuff up front let me focus on the internals/logic a bit more first. Once that was working, putting more explicit types in (return types, parameter types, etc) would help 'freeze' it in place.