Hacker News new | ask | show | jobs
by ancarda 1858 days ago
Double spaced lines of code? What do you mean?

FWIW, I no longer use DocBlocks because PHP's own type system is usually expressive enough.

2 comments

> PHP's own type system is usually expressive enough.

I'd say it's one of the worst type systems. Expressive enough not to need docblocks, ok. Expressive as a type system: hell no.

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>. 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> 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.

You 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 :)

Blank line above and below each line of code made even worse with opening brackets at column 1 of yet another new line. WTF!?