rfc:simple-annotations
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
rfc:simple-annotations [2016/05/13 10:52] – mindplay | rfc:simple-annotations [2016/05/13 11:15] – mindplay | ||
---|---|---|---|
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 are context-free - there is no access to variables in the parent class, file or global scope, no '' | + | By design, |
- | This is by design - annotations | + | Annotations |
You can think of an annotation ''<< | You can think of an annotation ''<< | ||
Line 91: | Line 91: | ||
function () { return expression(); | function () { return expression(); | ||
- | Annotations that do require context should explicitly ask for that context - for example, you could use an anonymous function to provide context via dependency injection. | + | Annotations that do require context should explicitly ask for that context - for example, you could use an anonymous function, a '' |
+ | |||
+ | ==== Reflection API ==== | ||
+ | |||
+ | 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 do not take into account inheritance - annotations belong to the actual *declaration*, | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== |
rfc/simple-annotations.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1