# [RFC] Reserve keywords in PHP 8

- Thread: https://externals.io/message/110504
- Original archive: https://news-web.php.net/php.internals/110504
- Started by Ilija Tovilo on 2020-06-13T19:10:19+00:00
- Messages: 8
- RFC: Reserve keywords in PHP 8 (Withdrawn) — https://externals.io/rfc/reserve_keywords_in_php_8.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #110504 — Ilija Tovilo — 2020-06-13T19:10:19+00:00

URL: https://externals.io/message/110504#110504

Hi internals

I created a new RFC for reserving keywords we might need in PHP 8.x versions.
https://wiki.php.net/rfc/reserve_keywords_in_php_8

Let me know if there's something you'd like to work on that will
require a keyword and I will add it to the list. The keywords will
most likely be voted on separately.

Ilija

---

## #110505 — Kalle Sommer Nielsen — 2020-06-13T19:32:51+00:00

URL: https://externals.io/message/110504#110505 · In reply to: #110504

Hi

Den lør. 13. jun. 2020 kl. 22.10 skrev Ilija Tovilo <tovilo.ilija@gmail.com>:
>
> Hi internals
>
> I created a new RFC for reserving keywords we might need in PHP 8.x versions.
> https://wiki.php.net/rfc/reserve_keywords_in_php_8
>
> Let me know if there's something you'd like to work on that will
> require a keyword and I will add it to the list. The keywords will
> most likely be voted on separately.

I do not see a point in soft reserving something we don't even know if
it will make it into 8.x. I mean sure you might work on some of them,
but they should be voted on a case by case basis. We did future
reserve somethings in the past for PHP6, e.g. the "b" string prefix
and the "(binary)" cast (for the then non unicode strings). See:
https://3v4l.org/nFJHb We stopped trying to future proof code by soft
reserving after PHP6 turned out to be nothing and most of the features
were ported to PHP5.3. I don't think we should go down that path again
of soft reserving something before we can guarantee it will be
implemented, something we cannot currently until it is voted in.

-- 
regards,

Kalle Sommer Nielsen
kalle@php.net

---

## #110506 — Matthew Brown — 2020-06-14T02:38:12+00:00

URL: https://externals.io/message/110504#110506 · In reply to: #110505

> I do not see a point in soft reserving something we don't even know if
> it will make it into 8.x. 

An enum implementation seems like something that almost certainly will make it into the language in the next 4 years, given PHP’s gradual adoption of features that already exist Hack (e.g. attributes, constructor property promotion).

While there have been many attempts to emulate enums in the language, none have the simplicity nor ergonomics of actual native enum support.

---

## #110509 — Ilija Tovilo — 2020-06-15T08:12:35+00:00

URL: https://externals.io/message/110504#110509 · In reply to: #110506

Hi Kalle, hi Matthew

> We stopped trying to future proof code by soft
> reserving after PHP6 turned out to be nothing and most of the features
> were ported to PHP5.3.

I wanted to reduce resistance to the RFC I'm planning because of BC
breaks in a minor version. For this reason I would personally prefer
to have the BC break in a major version but I'm ok with either
approach.

It's worth noting that we did indeed register some keywords in PHP 7
before they were used:
https://wiki.php.net/rfc/reserve_even_more_types_in_php_7

> An enum implementation seems like something that almost certainly
> will make it into the language in the next 4 years, given PHP’s
> gradual adoption of features that already exist Hack (e.g. attributes,
> constructor property promotion).

Yes, this is my sentiment too.

Ilija

---

## #110510 — Marco Pivetta — 2020-06-15T08:16:45+00:00

URL: https://externals.io/message/110504#110510 · In reply to: #110504

Hey Ilija,



> Hi internals
>
> I created a new RFC for reserving keywords we might need in PHP 8.x
> versions.
> https://wiki.php.net/rfc/reserve_keywords_in_php_8
>
> Let me know if there's something you'd like to work on that will
> require a keyword and I will add it to the list. The keywords will
> most likely be voted on separately.
>

This seems messy now, mostly because the `enum` symbol is very much in use
in very stable packages:

 * https://packagist.org/packages/marc-mabe/php-enum/stats
 * https://packagist.org/packages/myclabs/php-enum/stats

Greets,

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

---

## #110512 — Ilija Tovilo — 2020-06-15T09:18:09+00:00

URL: https://externals.io/message/110504#110512 · In reply to: #110510

Hi Marco

> > […]
>
> This seems messy now, mostly because the `enum` symbol is very much in use in very stable packages:
>
>  * https://packagist.org/packages/marc-mabe/php-enum/stats
>  * https://packagist.org/packages/myclabs/php-enum/stats

Hmm, I see your point. Although, myclabs/php-enum having the momentum
it does, the situation might be worse for PHP 8.1.

Ilija

---

## #110513 — Levi Morrison via internals — 2020-06-15T14:12:26+00:00

URL: https://externals.io/message/110504#110513 · In reply to: #110510

>
> Hey Ilija,
>
> 
>
> > […]
>
> This seems messy now, mostly because the `enum` symbol is very much in use
> in very stable packages:
>
>  * https://packagist.org/packages/marc-mabe/php-enum/stats
>  * https://packagist.org/packages/myclabs/php-enum/stats
>
> Greets,
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/

How viable would be a compilation warning when a `T_STRING` is `enum`?
I'm sure for the most part authors would much rather have enums in
core than to maintain their own, though I haven't looked at
implementations to see how "exotic" they are. If it's a warning then
we can manage until it's implemented and the software can continue
working but nobody will have to invest more time into it.

---

## #110514 — Alex — 2020-06-15T14:51:41+00:00

URL: https://externals.io/message/110504#110514 · In reply to: #110512

Maybe it would be good to talk to the developers of that package? They
might have some valuable input on how to design a built-in `enum`
feature.

It might also help them plan out a migration path.



>
> Hi Marco
>
> > […]
>
> Hmm, I see your point. Although, myclabs/php-enum having the momentum
> it does, the situation might be worse for PHP 8.1.
>
> Ilija
