rfc:context_sensitive_lexer
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:context_sensitive_lexer [2015/04/20 14:55] – update pull request link + fix some descriptions marcio | rfc:context_sensitive_lexer [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2015-02-15 | * Date: 2015-02-15 | ||
* Author: Márcio Almada | * Author: Márcio Almada | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 31: | Line 31: | ||
This RFC revisits the topic of [[https:// | This RFC revisits the topic of [[https:// | ||
- | presenting a minimal and maintainable [[https:// | + | presenting a minimal and maintainable [[https:// |
- | restricted to OO scope only, consistently comprehending: | + | |
* Properties, constants and methods defined on classes, interfaces and traits | * Properties, constants and methods defined on classes, interfaces and traits | ||
Line 52: | Line 51: | ||
==== Limitations ==== | ==== Limitations ==== | ||
- | On purpose, it's still forbidden to define '' | + | On purpose, it's still forbidden to define a **class constant** named as '' |
- | + | ||
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | So the following code would still be invalid: | + | |
- | + | ||
- | <code php> | + | |
- | class Foo { | + | |
- | const public|protected|private|static|abstract|final|class = ' | + | |
- | function public|protected|private|static|abstract|final(){} // Fatal error | + | |
- | } | + | |
- | + | ||
- | // Fatal error: Cannot declare a class const named as %d as it is reserved in %s on line %d | + | |
- | // Fatal error: Cannot declare a class method named as %d as it is reserved in %s on line %d | + | |
- | </ | + | |
- | + | ||
- | On purpose, it's still forbidden to define a **class constant** named as '' | + | |
<code php> | <code php> | ||
Line 82: | Line 60: | ||
// Fatal error: Cannot redefine class constant Foo::CLASS as it is reserved in %s on line %d | // Fatal error: Cannot redefine class constant Foo::CLASS as it is reserved in %s on line %d | ||
</ | </ | ||
+ | |||
+ | In practice, it means that we would drop from **64** to only **1** reserved word that affects only class constant names. | ||
'' | '' | ||
Line 92: | Line 72: | ||
(new Foo)-> | (new Foo)-> | ||
</ | </ | ||
- | |||
- | In practice, it means that we would drop from **64** to only **6** **globally** reserved words. | ||
===== Practical Examples ===== | ===== Practical Examples ===== | ||
Line 259: | Line 237: | ||
- Pull request with all the tests is at [[https:// | - Pull request with all the tests is at [[https:// | ||
+ | |||
+ | ==== Later Changes === | ||
+ | |||
+ | The *Patch 2* was merged and, later, method modifiers were allowed as class member names. This was a limitation from the older implementation candidate - Patch 1 - and there was no reason to keep it. The **Limitations** section was updated accordingly. Only the keyword **class** for class constants is reserved now. | ||
===== References ===== | ===== References ===== | ||
Line 266: | Line 248: | ||
===== Rejected Features ===== | ===== Rejected Features ===== | ||
- | * Prior to voting, the support for '' | + | * Prior to voting, the support for '' |
=> The RFC author will try to solve the wider problem on PHP 7.1 | => The RFC author will try to solve the wider problem on PHP 7.1 |
rfc/context_sensitive_lexer.1429541755.txt.gz · Last modified: 2017/09/22 13:28 (external edit)