First-class enum support in PHP Archived
Description
The PHP programming language currently lacks first-class support for enums. A common workaround is to use of integer or string class constants instead. Unfortunately, these do not provide a way to enforce that a value is part of a certain enum on the type-system level.
Enum implementations have a surprisingly large design space, ranging from unions of literal types, over Java-style enums, to algebraic variant types. Part of the task is to determine which approach is most suitable for PHP, and design the feature in a way that is coherent with the rest of the language.
Depending on the chosen approach, the enum implementation may encounter various technical difficulities. If enums use a new fundamental type, that type has to be supported across the engine and standard library. If enums are represented as objects, then it may be necessary to support immutable objects in constants and the opcode cache.
In this internship, you will:
- Learn how to make a major addition to a programming language, both in terms of design and implementation.
- Become familiar with PHP's implementation, and compiler/interpreter implementations in general.
- Maybe get a major feature accepted into PHP ;)
Requirements
Familiarity with and interest in the PHP programming language. Experience with C development.
Familiarity with compiler/interpreter development and language design would be ideal.
Mentors
Kirill Smelov, Nikita Popov
Contact details
internship@jetbrains.com
Location
All locations
Product/Team
PhpStorm