php-generics-rfc
Mirror of https://wiki.php.net/rfc/generics for easier collaboration (by PHPGenerics)
php-generics
PHP generics written in PHP (by mrsuh)
php-generics-rfc | php-generics | |
---|---|---|
13 | 7 | |
185 | 205 | |
2.2% | - | |
0.0 | 3.9 | |
almost 6 years ago | 26 days ago | |
PHP | ||
- | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
php-generics-rfc
Posts with mentions or reviews of php-generics-rfc.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-06-01.
-
What I always dreamed of PHP 😎 (IMPORTANT!)
About generics: it's very hard.
-
Generics via Attributes in PHP — Can We Have Them?
Nikita wrote a good summary about the topic and, even if we go with type erased, there still the syntax problem to solve.
-
Comparing PHP Collections
Ok) I wrote at the very beginning of the post which collections I will compare. There you can find links to the generics library. I will be very happy when the PHP IDE add support of generics, but the PHP community hasn't decided what the syntax will be. If you can help with this please let me know.
-
TypeScript is working on a proposal to add built-in types in JS that are ignored at runtime. This is exactly what PHP should do as well.
Nikic did a POC about generics a couple years ago and raised some concerns. The first one was performance, if types were to be validated on runtime, and the other was (as always in PHP...) syntax ambiguities, wich could require to use a new parser.
-
Generics implementation approaches
This approach has a small performance/memory effect. Nikita Popov already had an attempt to implement this type of generics in PHP.
-
PHP Generics. Right here. Right now
Doesn't support generic syntax because of RFC is not complete yet.
-
Hows the generics discussion going?
I was reading some stuff and found some discussion going here: https://github.com/PHPGenerics/php-generics-rfc/issues/45
-
Weekly "ask anything" thread
I assume familiarising yourself on the existing discussions on GitHub and the internals mailing list would be a start to understand what the issue with implementing them is, and why the delay for a real implementation. Nikita made some useful notes here: https://github.com/PHPGenerics/php-generics-rfc/issues/45
-
Type-constrained elements collection in PHP ?
These are called generics. PHP currently doesn't support them, but there is work being done towards them being added. There are a lot of complications that need to be figured out before they can be implemented. See https://github.com/PHPGenerics/php-generics-rfc/issues and https://github.com/Danack/RfcCodex/blob/master/generics.md.
php-generics
Posts with mentions or reviews of php-generics.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-03-03.
-
How come there is no such thing as an equivalent to TypeScript in PHP?
Hi. I'm the author of the library which brings generics into PHP like TypeScript https://github.com/mrsuh/php-generics. Libraries like this have a few big problems to start using them freely:
-
Parsing with PHP, Bison and re2c
I used this knowledge to create the PHP generics library.
-
Comparing PHP Collections
Hi! I don't think so. Is used this library to translate generics syntax into regular PHP syntax. It's not equal to real PHP generics (like Hack did). IDE doesn't support PHP generic syntax yet. You can read about it here.
If you are only using simple collections you can use array - it is very fast and requires little memory. PHP doesn't support generic syntax and IDE can't make hints about the type of objects in a collection (yet), but if you want PHP to do type checks at runtime you can test the php-generics library.
-
PHP type erasure generics
A few months ago I created a PHP generics library with monomorphic generics. Today I released version 1.2.0 with type erase generics.
-
Generics implementation approaches
This approach has a big memory effect. PHP doesn't support native generics, but you can test monomorphized generics with my library.
-
PHP Generics. Right here. Right now
} ``` Library: https://github.com/mrsuh/php-generics Example repo: https://github.com/mrsuh/php-generics-example Have a nice day!
What are some alternatives?
When comparing php-generics-rfc and php-generics you can also consider the following projects:
php-strict-array - Generator of strict arrays (vector, map)
php-var-sizeof - Function for getting size of any PHP variable in bytes
php-src - The PHP Interpreter
shim - Shim version of PHP CS Fixer