In this RFC https://wiki.php.net/rfc/bound_erased_generic_types Seifeddine Gmati proposed bound-erased generics for PHP. The RFC did not pass mainly because people thought that, if later on reified generics were added on top of this, there would be BC breaks for code that was not type checked and then started to be type checked. To try to avoid this objection, Rob Landers implemented an experimental reified version of generics on top of Seifeddine’s proposal.
There was very little discussion about this proposal because Seifeddine put the RFC to vote very soon after Rob sent it. I think that this was a very valid proposal that should have been explored in more detail. What I have tried to do is to bring this proposal forward and make it complete.
In this RFC https://wiki.php.net/rfc/bound_erased_generic_types Seifeddine Gmati proposed bound-erased generics for PHP. The RFC did not pass mainly because people thought that, if later on reified generics were added on top of this, there would be BC breaks for code that was not type checked and then started to be type checked. To try to avoid this objection, Rob Landers implemented an experimental reified version of generics on top of Seifeddine’s proposal.
There was very little discussion about this proposal because Seifeddine put the RFC to vote very soon after Rob sent it. I think that this was a very valid proposal that should have been explored in more detail. What I have tried to do is to bring this proposal forward and make it complete.
Thanks, it seems that to join a channel I also need to know the server where It lives (I’ve never used Discord much before). Can you share this info as well?
Thanks, it seems that to join a channel I also need to know the server
where It lives (I've never used Discord much before). Can you share
this info as well?
Cheers
Carlos
The PHP Community chat is unofficial, but lately it's where the big names are hanging out, including a lot of Internals regulars. Beware, the Internals channel is annoyingly noisy and has a hard time staying on topic.
Want to share some proof-of-concept and ideas regarding the Php Generics. I’ve recreated the memoization generics as a user-land library https://github.com/lisachenko/userland-php-generics, installable as a simple composer package to check the concept itself and see where we have limits now.
What I discovered - that a significant part of the core is suitable to define generics and keep the opcode arrays shared between all concrete memoized versions with different types:
I tried to deep-clone a template’s zend_class_entry under a new name and rewrited only the zend_type of its properties, parameters and return types while sharing the compiled method bodies through the engine’s own op_array refcount. Thus, cost of a specialization is about sizeof(zend_op_array) per method, independent of how large those methods are, rather than a full copy of the opcodes.
Thanks, it seems that to join a channel I also need to know the server
where It lives (I’ve never used Discord much before). Can you share
this info as well?
The PHP Community chat is unofficial, but lately it’s where the big names are hanging out, including a lot of Internals regulars. Beware, the Internals channel is annoyingly noisy and has a hard time staying on topic.