3 ms·
Dynamic typing is a trade off, one that requires some explicit type checking in some situations. It doesn't make it a stupid solution or a stupid problem. If
by waheoo 6y ago
Dynamic typing is a trade off, one that requires some explicit type checking in some situations.
It doesn't make it a stupid solution or a stupid problem.
If you validate and conform your types at program edges it's rare you ever really need to do type checking.
That is, a properly structured PHP application has all the benefits of dynamic typing and few of the problems that static type checking supposedly eliminates.
I like both static and dynamically typed languages.
Just like I like Async and non Async languages.
All language types require practice and learning to adjust to the different patterns that are required.
If you write PHP like JavaScript, or if you write PHP like java, or php like C++, you're going to have these problems.
If you write PHP like PHP, function heavy, class light, and a mix of functional and procedural depending on context it actually works out very well for a lot of things.
But go ahead, call the language stupid and irrespectable.
- ashton314 6y agoI like dynamic typing: most of my work is done in untyped Racket or Elixir. Weak typing is fun, but can be frustrating. My issue is that this single data structure functions like a list in some cases, and a map in others. Try piping the result of array_filter to array_map sometime. You can’t do it without an intermediate call to array_values first because the result of passing a list to array_filter does not behave like a list anymore: it operates strictly like a map and cannot have map called on it. (Oh the irony!)
- TazeTSchnitzel 6y agoarray_map works fine on the output of array_filter and produces a reasonable output in the same shape as the input.