scalar_objects icon indicating copy to clipboard operation
scalar_objects copied to clipboard

Can you bring this to PHP RFC?

Open HallofFamer opened this issue 10 years ago • 58 comments
trafficstars

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?

HallofFamer avatar Jan 26 '15 13:01 HallofFamer

I think there are a lot of PHP devs that would love to see this in the core...

terah avatar Feb 05 '15 22:02 terah

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.

HallofFamer avatar Feb 06 '15 09:02 HallofFamer

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.

nikic avatar Feb 12 '15 21:02 nikic

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!

HallofFamer avatar Feb 12 '15 21:02 HallofFamer

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.

TRPB avatar Mar 19 '15 10:03 TRPB

@nikic what about modifying $self within the handlers? It will be possible in PHP 7?

alanwillms avatar Apr 17 '15 16:04 alanwillms

@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 avatar Apr 17 '15 17:04 nikic

@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?

alanwillms avatar Aug 27 '15 18:08 alanwillms

+1, this looks really great and I am looking forward to see this in PHP 7!

c9s avatar Aug 31 '15 10:08 c9s

:+1: for this in php core

Strate avatar Sep 02 '15 09:09 Strate

Yep, +1.

TheXardas avatar Sep 02 '15 09:09 TheXardas

+1

alexkvak avatar Sep 02 '15 09:09 alexkvak

+1

sirsnyder avatar Sep 02 '15 10:09 sirsnyder

Also will be good to split to two RFC. One about engine level ability. And one about user space registration.

kandy avatar Sep 02 '15 12:09 kandy

+1

dominikzogg avatar Sep 03 '15 06:09 dominikzogg

@nikic "once this extension is ported to PHP 7"

Any progress on this?

robob4him avatar Sep 18 '15 15:09 robob4him

+1

vbsessa avatar Nov 13 '15 00:11 vbsessa

:+1:

brzuchal avatar Nov 18 '15 11:11 brzuchal

+1

dgafka avatar Nov 18 '15 11:11 dgafka

+1

sjaworski avatar Nov 18 '15 11:11 sjaworski

:+1:

jkonefal avatar Nov 18 '15 11:11 jkonefal

+1

event15 avatar Nov 18 '15 12:11 event15

+1

KennetPL avatar Nov 18 '15 12:11 KennetPL

:+1:

danizord avatar Nov 26 '15 19:11 danizord

+1

lgabeskiria avatar Dec 23 '15 01:12 lgabeskiria

+1

ctrl-f5 avatar Feb 17 '16 14:02 ctrl-f5

:+1:

marcelgsantos avatar Mar 03 '16 23:03 marcelgsantos

@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.

brzuchal avatar Mar 04 '16 06:03 brzuchal

+1

devypt avatar Apr 17 '16 14:04 devypt

+1

nilportugues avatar Apr 17 '16 15:04 nilportugues