scalar_objects
php-generics-rfc
scalar_objects | php-generics-rfc | |
---|---|---|
22 | 13 | |
1,124 | 185 | |
- | 2.2% | |
2.8 | 0.0 | |
6 months ago | almost 6 years ago | |
PHP | ||
MIT License | - |
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.
scalar_objects
-
What I always dreamed of PHP 😎 (IMPORTANT!)
I know there are such experiments, but it's unlikely to become a part of the language any time soon :(
- What is your #1 PHP feature request (part 2)
-
What is your #1 PHP feature request
Scalar objects has a prototype implementation since at least 2015: https://github.com/nikic/scalar_objects/issues/20
- Modern PHP features explained – PHP 8.0 and 8.1
-
Alternatives to Magic Methods?
For the love of god yes please yes this 1000x. I'd like to throw in scalar objects too.
-
Why does PHP not have object-oriented strings and arrays? Will it be added in a future version
Nikita Popov tried to solve the problem with this extension, but it never got wide support. The problem is that without users asking for this feature, Jetbrains and psalm/phpstan will not integrate it. But w/o their support, users cannot not even try the extension as everything will be shown as error.
-
Should PHP9 standardize naming conventions throughout the language?
These as it would remove the need to even care about the old function names which would exist for B/C purposes. We'd then be able to use primitive types as objects with functions to do all their manipulation as needed.
- Extension that adds support for method calls on primitive types in PHP
-
Which inconsistences of PHP annoy you the most?
It's been possible for quite a while but you have to enable a custom extension: https://github.com/nikic/scalar_objects and create an implementation of the class wrapper. I made one quite some time ago which is probably very incomplete: https://github.com/RikudouSage/scalar-objects.
- What third-party extension or library would you like to see included in php as default?
php-generics-rfc
-
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.
What are some alternatives?
php-docker - Docker Official Image packaging for PHP
php-generics - PHP generics written in PHP
Rector - Instant Upgrades and Automated Refactoring of any PHP 5.3+ code
php-strict-array - Generator of strict arrays (vector, map)
RfcCodex - Notes on PHP RFCs, and topics that occur repeatedly on PHP internals
php-src - The PHP Interpreter
varexporter - A powerful alternative to var_export(), which can export closures and objects without __set_state()
LazyIter - Lazy array function chains library for PHP inspired in Rust
pecl-php-operator - Operator overloading for Objects
you-are-using-it-wrong - :oncoming_police_car: Type check enforcement for library authors: enforces type-safety downstream
swow - Coroutine-based cross-platform concurrent I/O engine.
php-generics-example