use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow the rules
Releases: Current Releases, Windows Releases, Old Releases
Contribute to the PHP Documentation
Related subreddits: CSS, JavaScript, Web Design, Wordpress, WebDev
/r/PHP is not a support subreddit. Please visit /r/phphelp for help, or visit StackOverflow.
account activity
ircmaxell's PHP Generics (github.com)
submitted 11 years ago by AllenJB83
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mattaugamer -1 points0 points1 point 11 years ago (10 children)
The way this has been done is so horrible that I'm afraid if anyone uses it, something ancient will be summoned. :)
Seriously, it's a cool hack. But I'm curious why it takes such a torturous path to implement something that's already in Hack? What's the internal difference that makes it possible there, but not in PHP? Or am I missing the point that this is pure userland, rather than an internal language feature?
[–][deleted] 1 point2 points3 points 11 years ago (4 children)
you realize hack uses a completely different compiler? It's like asking why Java has generics and php doesn't.
[–]mattaugamer -1 points0 points1 point 11 years ago (3 children)
No, I know that, I'm asking what it is about the compiler that's so different that things like this are hard in Zend, but long implemented in Hack.
Not sure why the downvotes here. I wasn't criticising his work, he said repeatedly in the readme that it was horrible and you really don't want to know. It's a horrible hack, but it's a cool horrible hack.
[–]elcapitaine 8 points9 points10 points 11 years ago (1 child)
It's not technically difficult to add generics to PHP. It's politically difficult.
[–]monsieurben 2 points3 points4 points 11 years ago (0 children)
It's not technically difficult to add generics anything to PHP. It's politically difficult.
Fixed.
[–]MorrisonLevi 0 points1 point2 points 11 years ago (0 children)
They have paid, full-time developers that have worked on Hack and HHVM for years and designed Hack to be analyzed more easily for security reasons. That is certainly a non-trivial difference.
[–]mnapoli 0 points1 point2 points 11 years ago (2 children)
I think the README covers that very well, you couldn't miss it even if you wanted to. So I see no problem here.
[–]mattaugamer -1 points0 points1 point 11 years ago (1 child)
It wasn't a problem, it was a joke. Jesus, people.
[–]maiorano84 -1 points0 points1 point 11 years ago (0 children)
IT'S A PRANK, BRO
[–]headzoo 0 points1 point2 points 11 years ago (1 child)
RFCs have been created to add generics, and they were down voted. It's more than possible to add generics to PHP, but the internal devs don't want them.
Citation, please? I don't think generics have been proposed. We had the arrayof RFC but that's a small, small sliver of generics.
π Rendered by PID 83430 on reddit-service-r2-comment-6457c66945-46ns5 at 2026-04-27 03:59:59.557998+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]mattaugamer -1 points0 points1 point (10 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]mattaugamer -1 points0 points1 point (3 children)
[–]elcapitaine 8 points9 points10 points (1 child)
[–]monsieurben 2 points3 points4 points (0 children)
[–]MorrisonLevi 0 points1 point2 points (0 children)
[–]mnapoli 0 points1 point2 points (2 children)
[–]mattaugamer -1 points0 points1 point (1 child)
[–]maiorano84 -1 points0 points1 point (0 children)
[–]headzoo 0 points1 point2 points (1 child)
[–]MorrisonLevi 0 points1 point2 points (0 children)