[RFC] [VOTE] Object typehint RFC

php.internals

Michał Brzuchalski

9 years ago
Hi everyone, I would like to put Object Type RFC up to a vote for inclusion in PHP 7.2. Previously there were some concerns about adding named types in the future, but we came to the conclusion that each of them can be solved if there are proposals in the future. Voting starts today, 2017-05-17, and will close after two weeks on the Wednesday 2017-05-31 at midnight. The RFC and voting widget can be found here: https://wiki.php.net/ rfc/object-typehint The vote is a straight Yes/No vote for accepting the RFC and merging the patch which require 2/3 majority. The additional vote is also a straight Yes/No vote for accepting variance behaviour on the object type which also require 2/3 majority. Thanks!
-- regards / pozdrawiam, -- Michał Brzuchalski about.me/brzuchal brzuchalski.com

Levi Morrison

9 years ago
On Wed, May 17, 2017 at 4:34 AM, Michał Brzuchalski <michal@brzuchalski.com> wrote:
> Hi everyone, > > I would like to put Object Type RFC up to a vote for inclusion in PHP 7.2. > > Previously there were some concerns about adding named types in the future, > but we came to the conclusion that each of them can be solved if there are > proposals in the future. > > Voting starts today, 2017-05-17, and will close after two weeks on the > Wednesday 2017-05-31 at midnight. > > The RFC and voting widget can be found here: https://wiki.php.net/ > rfc/object-typehint > > The vote is a straight Yes/No vote for accepting the RFC and merging the > patch which require 2/3 majority. > The additional vote is also a straight Yes/No vote for accepting variance > behaviour on the object type which also require 2/3 majority. > > Thanks! > -- > regards / pozdrawiam, > -- > Michał Brzuchalski > about.me/brzuchal > brzuchalski.com >
An emphatic "no" on variance for me. This is for two over-arching reasons: 1. Object variance should be implemented when we have generalized variance for all types. By special casing it now we open ourselves to the possibility that its implementation or semantics will differ from the generalized solution. 2. The way it is implemented prevents us from adding new types which are not objects. The reason is that the way this is implemented it just assumes that an unknown type is an object type. If we add a feature such as an enumerations (enums) this assumption probably breaks and cannot be fixed while maintaining BC as it would almost certainly need to trigger an autoload. Given these two points I think it's unwise to implement variance as outlined. I highly encourage other voters to vote against that portion of the RFC. ----- Lastly, I want to thank Dan and Michal for working on this RFC as an object type even without variance would have been useful for me in the past.

Andrey Andreev

9 years ago
Hi, On Wed, May 17, 2017 at 5:47 PM, Levi Morrison <levim@php.net> wrote:
> > 1. Object variance should be implemented when we have generalized > variance for all types. By special casing it now we open ourselves to the > possibility that its implementation or semantics will differ from the > generalized solution. >
That's a very good point. It may even decide how variance works in all of PHP, "because consistency". Cheers, Andrey.

Sebastian Bergmann

9 years ago
On 05/17/2017 04:47 PM, Levi Morrison wrote:
> An emphatic "no" on variance for me. This is for two over-arching reasons:
Thank you, Levi, for the explanation of your "no" vote on object variance. That saved me quite a bit of typing :-)

Michał Brzuchalski

9 years ago
Thank your Levi for your explanation. 2017-05-17 16:47 GMT+02:00 Levi Morrison <levim@php.net>:
> > > On Wed, May 17, 2017 at 4:34 AM, Michał Brzuchalski < > michal@brzuchalski.com> wrote: > >> Hi everyone, >> >> I would like to put Object Type RFC up to a vote for inclusion in PHP 7.2. >> >> Previously there were some concerns about adding named types in the >> future, >> but we came to the conclusion that each of them can be solved if there are >> proposals in the future. >> >> Voting starts today, 2017-05-17, and will close after two weeks on the >> Wednesday 2017-05-31 at midnight. >> >> The RFC and voting widget can be found here: https://wiki.php.net/ >> rfc/object-typehint <https://wiki.php.net/rfc/object-typehint> >> >> The vote is a straight Yes/No vote for accepting the RFC and merging the >> patch which require 2/3 majority. >> The additional vote is also a straight Yes/No vote for accepting variance >> behaviour on the object type which also require 2/3 majority. >> >> Thanks! >> -- >> regards / pozdrawiam, >> -- >> Michał Brzuchalski >> about.me/brzuchal >> brzuchalski.com >> > > An emphatic "no" on variance for me. This is for two over-arching reasons: > > 1. Object variance should be implemented when we have generalized > variance for all types. By special casing it now we open ourselves to the > possibility that its implementation or semantics will differ from the > generalized solution. > > 2. The way it is implemented prevents us from adding new types which are > not objects. The reason is that the way this is implemented it just assumes > that an unknown type is an object type. If we add a feature such as an > enumerations (enums) this assumption probably breaks and cannot be fixed > while maintaining BC as it would almost certainly need to trigger an > autoload. > >
We were thinking about enumerations and generally IMHO, they can be implemented as objects though. Especially when taking Java pattern http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html when dealing with enumeration means dealing with a special purpose and special kind of objects, which are IMO more powerful with methods which can implement some behaviour.
> Given these two points I think it's unwise to implement variance as > outlined. I highly encourage other voters to vote against that portion of > the RFC. > > ----- > > Lastly, I want to thank Dan and Michal for working on this RFC as an > object type even without variance would have been useful for me in the past. >
-- regards / pozdrawiam, -- Michał Brzuchalski about.me/brzuchal brzuchalski.com

Levi Morrison

9 years ago
On Wed, May 17, 2017 at 10:26 AM, Michał Brzuchalski <michal@brzuchalski.com
> wrote:
> Thank your Levi for your explanation. > > 2017-05-17 16:47 GMT+02:00 Levi Morrison <levim@php.net>: > >> >> >> On Wed, May 17, 2017 at 4:34 AM, Michał Brzuchalski < >> michal@brzuchalski.com> wrote: >> >>> Hi everyone, >>> >>> I would like to put Object Type RFC up to a vote for inclusion in PHP >>> 7.2. >>> >>> Previously there were some concerns about adding named types in the >>> future, >>> but we came to the conclusion that each of them can be solved if there >>> are >>> proposals in the future. >>> >>> Voting starts today, 2017-05-17, and will close after two weeks on the >>> Wednesday 2017-05-31 at midnight. >>> >>> The RFC and voting widget can be found here: https://wiki.php.net/ >>> rfc/object-typehint <https://wiki.php.net/rfc/object-typehint> >>> >>> The vote is a straight Yes/No vote for accepting the RFC and merging the >>> patch which require 2/3 majority. >>> The additional vote is also a straight Yes/No vote for accepting variance >>> behaviour on the object type which also require 2/3 majority. >>> >>> Thanks! >>> -- >>> regards / pozdrawiam, >>> -- >>> Michał Brzuchalski >>> about.me/brzuchal >>> brzuchalski.com >>> >> >> An emphatic "no" on variance for me. This is for two over-arching reasons: >> >> 1. Object variance should be implemented when we have generalized >> variance for all types. By special casing it now we open ourselves to the >> possibility that its implementation or semantics will differ from the >> generalized solution. >> >> 2. The way it is implemented prevents us from adding new types which >> are not objects. The reason is that the way this is implemented it just >> assumes that an unknown type is an object type. If we add a feature such as >> an enumerations (enums) this assumption probably breaks and cannot be fixed >> while maintaining BC as it would almost certainly need to trigger an >> autoload. >> >> > We were thinking about enumerations and generally IMHO, they can be > implemented as objects though. Especially when taking Java pattern > http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html when dealing > with enumeration means dealing with a special purpose and special kind of > objects, which are IMO more powerful with methods which can implement some > behaviour. >
I'm not intending to derail the thread but let's consider your statement: your proposal constrains us to choosing something Java-like instead of having all options. Think closely about that: you are advocating that we constrain us to Java-like enums when there are many, many options and we get what for that trade-off? A simpler way to implement variance for the object-type only? No thanks.

Michał Brzuchalski

9 years ago
2017-05-17 18:43 GMT+02:00 Levi Morrison <levim@php.net>:
> I'm not intending to derail the thread but let's consider your statement: > your proposal constrains us to choosing something Java-like instead of > having all options. Think closely about that: you are advocating that we > constrain us to Java-like enums when there are many, many options and we > get what for that trade-off? A simpler way to implement variance for the > object-type only? No thanks.
No offence Levi, it was just an example of enums implementation. Maybe I should not now point it in this thread. My apologies.
-- regards / pozdrawiam, -- Michał Brzuchalski about.me/brzuchal brzuchalski.com

Dan Ackroyd

9 years ago
> We were thinking about enumerations
Who do you mean 'we', kemosabe?
> Especially when taking Java pattern
Java has been limited in its design as almost everything had to be an object, whether or not it was a good fit for what was needed. For me, objects are good at storing state, hiding implementation details and allowing type substitution.....pretty much none of those things apply to enums, and so make me think that forcing enums to be objects isn't always the right thing to do. cheers Dan

Michał Brzuchalski

9 years ago
2017-05-17 19:12 GMT+02:00 Dan Ackroyd <danack@basereality.com>:
> > We were thinking about enumerations > > Who do you mean 'we', kemosabe? >
My apologies. I was a little hurry.
> > > Especially when taking Java pattern > > Java has been limited in its design as almost everything had to be an > object, whether or not it was a good fit for what was needed. > > For me, objects are good at storing state, hiding implementation > details and allowing type substitution.....pretty much none of those > things apply to enums, and so make me think that forcing enums to be > objects isn't always the right thing to do. > > cheers > Dan >
-- regards / pozdrawiam, -- Michał Brzuchalski about.me/brzuchal brzuchalski.com

Nikita Popov

9 years ago
On Wed, May 17, 2017 at 12:34 PM, Michał Brzuchalski <michal@brzuchalski.com
> wrote:
> Hi everyone, > > I would like to put Object Type RFC up to a vote for inclusion in PHP 7.2. > > Previously there were some concerns about adding named types in the future, > but we came to the conclusion that each of them can be solved if there are > proposals in the future. > > Voting starts today, 2017-05-17, and will close after two weeks on the > Wednesday 2017-05-31 at midnight. > > The RFC and voting widget can be found here: https://wiki.php.net/ > rfc/object-typehint <https://wiki.php.net/%0Arfc/object-typehint> > > The vote is a straight Yes/No vote for accepting the RFC and merging the > patch which require 2/3 majority. > The additional vote is also a straight Yes/No vote for accepting variance > behaviour on the object type which also require 2/3 majority. >
I've closed the vote on https://wiki.php.net/rfc/object-typehint, as it was supposed to close three days ago. The RFC has been accepted with 32 in favor and 3 against. Variance support has been rejected with 10 in favor and 20 against. Please rebase your implementation and update it for the decision regarding the variance. Thanks, Nikita

Michał Brzuchalski

9 years ago
Hi everyone, proposed PR https://github.com/php/php-src/pull/2080 was rebased before variance patch and adjusted to current master implementation. Currently waiting for merge. Thanks everyone for voting. regards,
-- Michał Brzuchalski 2017-06-03 12:54 GMT+02:00 Nikita Popov <nikita.ppv@gmail.com>: > On Wed, May 17, 2017 at 12:34 PM, Michał Brzuchalski < > michal@brzuchalski.com> wrote: > >> Hi everyone, >> >> I would like to put Object Type RFC up to a vote for inclusion in PHP 7.2. >> >> Previously there were some concerns about adding named types in the >> future, >> but we came to the conclusion that each of them can be solved if there are >> proposals in the future. >> >> Voting starts today, 2017-05-17, and will close after two weeks on the >> Wednesday 2017-05-31 at midnight. >> >> The RFC and voting widget can be found here: https://wiki.php.net/ >> rfc/object-typehint <https://wiki.php.net/%0Arfc/object-typehint> >> >> The vote is a straight Yes/No vote for accepting the RFC and merging the >> patch which require 2/3 majority. >> The additional vote is also a straight Yes/No vote for accepting variance >> behaviour on the object type which also require 2/3 majority. >> > > I've closed the vote on https://wiki.php.net/rfc/object-typehint, as it > was supposed to close three days ago. > > The RFC has been accepted with 32 in favor and 3 against. Variance support > has been rejected with 10 in favor and 20 against. > > Please rebase your implementation and update it for the decision regarding > the variance. > > Thanks, > Nikita > -- regards / pozdrawiam, -- Michał Brzuchalski about.me/brzuchal brzuchalski.com