Open HallofFamer opened 9 years ago
I think there are a lot of PHP devs that would love to see this in the core...
yeah of course, for developers who want to use strongly typed PHP scalars, this will help tremendously. Please do consider bringing it to PHP RFC.
I won't have the time to propose this for inclusion in PHP 7. Adding this to core would require quite a lot of work and feature freeze is not far away.
By the way, I already added support for syntax like "abc"->toUpper()
and [1, 2, 3]->reverse()
to PHP 7 (it will just throw a runtime error). So once this extension is ported to PHP 7, you'll be able to use that syntax in conjunction with the ext.
I see, thats a pity, I really hope to see this on PHP 7.0, but guess it wont be there at least till 7.1... Still, you can start an RFC to prepare for the future, even if it will not be going to voting phase anytime soon, right?
And its very good news, I very love the syntax like "mystring"->length() and [2, 5, 4, 6]->sort(). It will be very useful, cant wait for the new Scalar object for PHP 7!
Shame, I'd have also loved to have seen this in PHP7. As I mentioned in one of the other issues, this is a perfect opportunity to fix the inconsistent function naming and parameter orders... $str->replace(), $array->combine() etc.
@nikic what about modifying $self
within the handlers? It will be possible in PHP 7?
@alanwillms Nope, the current VM implementation doesn't allow this. With enough effort it might be possible, but would probably have negative performance impact for all other method calls (which is pretty much a no-go).
@nikic not modifying $self
may be a good thing since it enforces immutability.
Now that PHP 7.0 is frozen and won't have any new features, will you open a RFC targeting 7.1?
+1, this looks really great and I am looking forward to see this in PHP 7!
:+1: for this in php core
Yep, +1.
+1
+1
Also will be good to split to two RFC. One about engine level ability. And one about user space registration.
+1
@nikic "once this extension is ported to PHP 7"
Any progress on this?
+1
:+1:
+1
+1
:+1:
+1
+1
:+1:
+1
+1
:+1:
@nikic are there any chances to bring this to RFC into the core of PHP? This feature is awesome and there are plenty of people looking forward for this.
+1
+1
Just a reminder everyone that you can add a reaction to comments rather than cluttering the comments with +1.
+1
+1
+1
+1
please stop replying "+1", to vote just add reaction to the original comment. You are spamming all participants' mailboxes.
Will this be possible in PHP 7.2?
no, there hasn't even been an RFC for this, so it can not possibly be scheduled to be in a future release.
What can we do to bring this closer to an RFC?
+1
+1
Hope for PHP 8.x or 9.x
This feature is awesome! 👍 Please do consider bringing it to PHP RFC. @laruence @nikic 👍
PHP core developers are discussing about tagging the next release after 7.3 as 8.0. Maybe now is the time.
An entire year has passed already...do you know any news on this? Thanks!
So interesting but handlers should be applied in a specific scope.
An entire year has passed already...do you know any news on this? Thanks!
It doesn't seam to be planned for v8!
Definitively I think C#'s Extension Method is our goal.
So it hasn't gone to an RFC for... four years now? What's stopping it?
@mpyw yup this one has the potential to allow any types to be extended instead of just primitive types, though unlike C# which is compiled, in PHP you will have to manually include the files that contain extension methods.
Anyway, I think, its about time to bring this to PHP RFC. It will be a neat feature for PHP 8, a good chance to introduce OO API for scalar types, as well as fixing the messy function names that cannot be touched due to backward compatibility issue.
I took a look at it and I very like what is being implemented. In my own framework I use classes for Int, Float, String and Array, but sometimes it can be a bit tedious(like having to write new String("abc") than just "abc"). This library will fix a lot of issues in my codebase, and make coding 10x more enjoyable. Also if its implemented at the PHP core, there's a chance to suggest a way to make even more elegant syntax work, such as "abc"->toUpper() which does not happen yet. So, will you consider moving this to RFC and possibly have PHP internals implement it in PHP 7?