DPC2023: Generics aren’t coming

Php

Discover why PHP won't adopt generics, exploring alternative approaches to type safety and the language's future direction.

Key takeaways
  • PHP will not implement generics, which are features that allow for the creation of reusable code that can work with different data types.
  • The speaker describes the concept of generics and how they can provide benefits such as code reuse and reduced errors.
  • Generics are not being implemented in PHP because of the complexity involved and the resources required to do so.
  • PHP’s runtime type system is a significant part of its appeal, but it can also make it difficult to implement generics.
  • The speaker suggests that other approaches, such as static analysis, can be used to achieve some of the benefits of generics.
  • The PHP community is unlikely to adopt generics, and the speaker expects that PHP will not change its approach.
  • There are other programming languages, such as TypeScript, that do implement generics and have achieved significant benefits from them.
  • The speaker emphasizes the importance of using static analysis and other tools to achieve type safety in PHP.
  • The speaker also highlights the need for more discussion and debate within the PHP community about the future direction of the language.
  • It is unlikely that PHP will ever implement generics, and the speaker is advocating for alternative approaches to achieve the same benefits.
  • Generics are not essential for PHP and other programming languages do not implement them.
  • The speaker’s presentation does not provide much hope for PHP to adopt generics.