Re: [PHP-DEV] [VOTE] Enumerations

2021-02-17 Thread Ben Ramsey
> On Feb 17, 2021, at 12:08, Rowan Tommins  wrote:
> 
> On 17/02/2021 17:51, Ben Ramsey wrote:
>>> On Feb 17, 2021, at 11:48, Chase Peeler  wrote:
>>> 
>>> If that were to not pass, though, it seems supporting enum cases as keys 
>>> would be worth exploring. Fully support allowing all objects as keys though.
>> 
>> Others, please correct me if I’m wrong, but I believe each enum case is 
>> already an object.
> 
> 
> I think what Chase meant was that if we don't want to allow *all* objects as 
> keys, we could allow *a specific subset*, namely Enum cases.
> 
> The implementation would be similar, but deliberately limiting the scope 
> might avoid some undesirable edge cases and side effects.


Sorry. When I read “were to not pass,” my brain missed the “not” part. :-)

Cheers,
Ben


signature.asc
Description: Message signed with OpenPGP


Re: [PHP-DEV] [VOTE] Enumerations

2021-02-17 Thread Rowan Tommins

On 17/02/2021 17:51, Ben Ramsey wrote:

On Feb 17, 2021, at 11:48, Chase Peeler  wrote:

If that were to not pass, though, it seems supporting enum cases as keys would 
be worth exploring. Fully support allowing all objects as keys though.


Others, please correct me if I’m wrong, but I believe each enum case is already 
an object.



I think what Chase meant was that if we don't want to allow *all* 
objects as keys, we could allow *a specific subset*, namely Enum cases.


The implementation would be similar, but deliberately limiting the scope 
might avoid some undesirable edge cases and side effects.



Regards,

--
Rowan Tommins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



Re: [PHP-DEV] [VOTE] Enumerations

2021-02-17 Thread Ben Ramsey
> On Feb 17, 2021, at 11:48, Chase Peeler  wrote:
> 
> If that were to not pass, though, it seems supporting enum cases as keys 
> would be worth exploring. Fully support allowing all objects as keys though.


Others, please correct me if I’m wrong, but I believe each enum case is already 
an object.

Cheers,
Ben


signature.asc
Description: Message signed with OpenPGP


Re: [PHP-DEV] [VOTE] Enumerations

2021-02-17 Thread Chase Peeler
On Wed, Feb 17, 2021 at 12:41 PM Ben Ramsey  wrote:

> > On Feb 17, 2021, at 09:26, Chase Peeler  wrote:
> >
> > On Wed, Feb 17, 2021 at 10:09 AM Rowan Tommins 
> > wrote:
> >
> >> On 17/02/2021 14:30, Larry Garfield wrote:
> >>> The Enum RFC has been approved.
> >>
> >>
> >> Thank you and Ilija so much for putting in the effort to make such a
> >> carefully thought-through proposal, and I'm really looking forward to
> >> being able to use it.
> >>
> >> I realise not everyone agrees with the approach, but am hopeful that it
> >> can be expanded on in future proposals to add a lot of power to the
> >> language.
> >>
> >>
> > Glad to see this passed. I definitely would have voted for it if I had a
> > vote. The only thing I wish had been included was the ability to use them
> > as array keys, but definitely don't think the lack of that would be a
> > reason to vote against it - especially since the possibility is still
> open
> > in the future and adding it wouldn't cause any BC issues.
>
>
> There’s an RFC for that. ;-)
>
> https://wiki.php.net/rfc/object_keys_in_arrays
>
> Cheers,
> Ben
>
>
If that were to not pass, though, it seems supporting enum cases as keys
would be worth exploring. Fully support allowing all objects as keys though.

-- 
Chase Peeler
chasepee...@gmail.com


Re: [PHP-DEV] [VOTE] Enumerations

2021-02-17 Thread Ben Ramsey
> On Feb 17, 2021, at 09:26, Chase Peeler  wrote:
> 
> On Wed, Feb 17, 2021 at 10:09 AM Rowan Tommins 
> wrote:
> 
>> On 17/02/2021 14:30, Larry Garfield wrote:
>>> The Enum RFC has been approved.
>> 
>> 
>> Thank you and Ilija so much for putting in the effort to make such a
>> carefully thought-through proposal, and I'm really looking forward to
>> being able to use it.
>> 
>> I realise not everyone agrees with the approach, but am hopeful that it
>> can be expanded on in future proposals to add a lot of power to the
>> language.
>> 
>> 
> Glad to see this passed. I definitely would have voted for it if I had a
> vote. The only thing I wish had been included was the ability to use them
> as array keys, but definitely don't think the lack of that would be a
> reason to vote against it - especially since the possibility is still open
> in the future and adding it wouldn't cause any BC issues.


There’s an RFC for that. ;-)

https://wiki.php.net/rfc/object_keys_in_arrays

Cheers,
Ben



signature.asc
Description: Message signed with OpenPGP


Re: [PHP-DEV] [VOTE] Enumerations

2021-02-05 Thread Dan Ackroyd
On Wed, 3 Feb 2021 at 17:29, Larry Garfield  wrote:
>
> The vote on the Enumerations RFC is hereby opened.  It will run until 17 
> February 2021.

The no vote for this is slightly higher than I was expecting. I
understand that some people think enums should be 'just consts' and
some people might not like using objects for the implementation.

Other than those two, does anyone want to mention any other big
downsides that weren't raised during the conversation?

cheers
Dan
Ack

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php



[PHP-DEV] [VOTE] Enumerations

2021-02-03 Thread Larry Garfield
The vote on the Enumerations RFC is hereby opened.  It will run until 17 
February 2021.

https://wiki.php.net/rfc/enumerations

Vote now, or forever hold your memory allocations.

-- 
  Larry Garfield
  la...@garfieldtech.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php