Latest Tech News

Stay updated with the latest in technology, AI, cybersecurity, and more

Filtered by: generics Clear Filter

PHP Almost Generics: Guided Journey Through the Official Compile-Time Proposal

Generics in PHP: From Blog Series to Book Doğan Uçar 3 min read · 1 day ago 1 day ago -- Listen Share Press enter or click to view image in full size Almost Generics in PHP: A Guided Journey Through the Official Compile-Time Proposal For more than a decade, PHP developers have debated one question: Should PHP have generics? Generics are a cornerstone feature in many languages — from Java and C# to TypeScript. They allow developers to write reusable, type-safe code without endless duplication

PHP compile time generics: yay or nay?

One of the most sought-after features for PHP is Generics: The ability to have a type that takes another type as a parameter. It's a feature found in most compiled languages by now, but implementing generics in an interpreted language like PHP, where all the type checking would have to be done at runtime, has always proven Really Really Hard(tm), Really Really Slow(tm), or both. But, experimentation by the PHP Foundation's dev team suggests we may be able to get 80% of the benefit for 20% of th