Re: [RFC] Allow object keys in arrays
| From: | Björn Larsson | Date: | Tue, 12 Jan 2021 16:10:50 +0000 |
| Subject: | Re: [RFC] Allow object keys in arrays | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112848@lists.php.net to get a copy of this message | ||
Den 2021-01-11 kl. 15:28, skrev Nikita Popov:
Hi internals, I would like to present a draft RFC for allowing object keys in arrays: https://wiki.php.net/rfc/object_keys_in_arrays The specification in the RFC is incomplete, and primarily focussed on what impact this has from an internal perspective. https://github.com/php/php-src/pull/6588 is a draft implementation that illustrates the necessary changes. The primary motivation, and reason why I am looking into this now, is that the current enum proposal is based on objects, and I consider it somewhat important that enum values can also work as array keys. From a technical perspective, this also lays the groundwork for supporting other key types in the future, e.g. if we wish to switch PHP to use arbitrary-precision integers. Regards, Nikita+1 for the feature itself, really nice! It makes the ENUM feature more complete. The implementation aspects I can't judge though. r//Björn L