2 ms·
I meant expressive enough that you don't need DocBlocks as often. We're nowhere near being done, PHP still lacks proper Generics and Algebraic Data Types. Recen
by ancarda 5y ago
I meant expressive enough that you don't need DocBlocks as often. We're nowhere near being done, PHP still lacks proper Generics and Algebraic Data Types. Recently we got Union Types (8.0) and will soon have Enums (8.1).
If you really needed generics today, you can do it with DocBlocks and static analyzers like PHPStan: <https://phpstan.org/blog/generics-in-php-using-phpdocs https://phpstan.org/blog/generics-in-php-using-phpdocs>. I'm hopeful that in the future, you won't need a DocBlock for that.
As for ADTs, there's some on going discussions here: <https://wiki.php.net/rfc/adts https://wiki.php.net/rfc/adts> which would build upon the existing support for Enums (8.1). I'm really looking forward to being able to have something resembling Optional/Maybe.
I'm by no means saying what PHP has is enough today, just that it's less limited than it was a few years ago. It'll be even less limited in the future.
- cies 5y agoYou just said exactly what I said in my comment you reply on. More words, and more promo for future versions of PHP. Seriously, try build something trivial with a strongly typed lang like Haskell or Elm (Elm is quite easy to get started with), and we can talk type systems after :)