rfc:namespaced_names_as_token
Differences
This shows you the differences between two versions of the page.
| Next revisionBoth sides next revision |
rfc:namespaced_names_as_token [2020/06/15 15:16] – created nikic | rfc:namespaced_names_as_token [2020/06/15 15:19] – nikic |
---|
===== Introduction ===== | ===== Introduction ===== |
| |
PHP currently treats namespaced names like ''Foo\Bar'' as a sequence of identifier and namespace separator tokens. This RFC proposed to treat namespaced names as a single token, an as such allow reserved keywords to appear inside them. At the same time, it proposes to lift reserved keyword restrictions for class, function and constant declarations. | PHP currently treats namespaced names like ''Foo\Bar'' as a sequence of identifier and namespace separator tokens. This RFC proposed to treat namespaced names as a single token, and as such allow reserved keywords to appear inside them. At the same time, it proposes to lift reserved keyword restrictions for class, function and constant declarations. |
| |
The motivation is to reduce the backwards compatibility impact of new reserved keyword additions in future versions of PHP. To give a specific example, PHP 7.4 added the ''fn'' keyword as part of arrow function support. This broke my [[https://github.com/nikic/iter|iter library]], because it was using ''fn'' as part of a namespace name. However, this breakage was entirely unnecessary! Here is a typical usage example: | The motivation is to reduce the backwards compatibility impact of new reserved keyword additions in future versions of PHP. To give a specific example, PHP 7.4 added the ''fn'' keyword as part of arrow function support. This broke my [[https://github.com/nikic/iter|iter library]], because it was using ''fn'' as part of a namespace name. However, this breakage was entirely unnecessary! Here is a typical usage example: |
rfc/namespaced_names_as_token.txt · Last modified: 2020/07/31 12:54 by nikic