TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

What the hell are Generics and would I want them in PHP?

2 pointsby TheEdonianalmost 8 years ago

1 comment

CamTinalmost 8 years ago
For anyone that is struggling to understand generics in regular Java&#x2F;c#-ish languages, have a go at learning the basics of CLOS, the Common Lisp object system. This uses &quot;generics&quot; (&quot;generic functions&quot; in CLOS jargon) as a pretty fundamental component, essentially doing what method calls are in an &quot;ordinary&quot; OO language. In fact, CLers tend to use &quot;method&quot; to mean &quot;generic function with a signature that contains this class, plus some other assumptions&quot;.<p>Once you &quot;get&quot; OO where all method calls are generic calls, you will have a more intuitive understanding of them.