rfc:simple-annotations
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:simple-annotations [2016/05/13 10:52] – mindplay | rfc:simple-annotations [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Simple Annotations ====== | ====== PHP RFC: Simple Annotations ====== | ||
- | * Version: 0.1 | + | * Version: 0.3 |
* Date: 2016-05-13 | * Date: 2016-05-13 | ||
* Author: Rasmus Schultz, rasmus@mindplay.dk | * Author: Rasmus Schultz, rasmus@mindplay.dk | ||
Line 9: | Line 9: | ||
===== Introduction ===== | ===== Introduction ===== | ||
- | This RFC proposes the introduction of simple value annotations - arbitrary | + | This RFC proposes the introduction of simple value annotations - arbitrary values |
As an alternative proposal to [[https:// | As an alternative proposal to [[https:// | ||
Line 17: | Line 17: | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | The proposed syntax of a single annotation is extremely | + | The proposed syntax of a single annotation is very simple: |
< | < | ||
Line 81: | Line 81: | ||
Annotation expressions are not evaluated until reflection is invoked, and are evaluated only once and internally memoized upon the first call to '' | Annotation expressions are not evaluated until reflection is invoked, and are evaluated only once and internally memoized upon the first call to '' | ||
- | ==== Context | + | ==== Annotations are Context-free ==== |
- | Annotations | + | By design, annotations expressions |
- | This is by design - annotations | + | Annotations |
- | You can think of an annotation | + | Annotations that do require context should explicitly ask for that context - for example, you could use an anonymous function, a '' |
- | function () { return expression(); | + | ==== Reflection API ==== |
- | Annotations that do require context should explicitly ask for that context | + | The following classes will have an added '' |
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | The '' | ||
+ | |||
+ | public function getAnnotations($filter = null) : array | ||
+ | |||
+ | The optional '' | ||
+ | |||
+ | * If one of '' | ||
+ | * If a fully-qualified class-name is given, filters annotations using '' | ||
+ | |||
+ | If '' | ||
+ | |||
+ | These methods | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 123: | Line 141: | ||
Annotations are a new feature - it does not affect any existing functionality. | Annotations are a new feature - it does not affect any existing functionality. | ||
- | ===== Future | + | ===== Out of Scope ===== |
- | TODO file-level annotations? | + | It has been suggested that this RFC should reserve certain names for compiler directives, such as (for instance) the memoization-directive [[https:// |
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== |
rfc/simple-annotations.1463136766.txt.gz · Last modified: 2017/09/22 13:28 (external edit)