rfc:simple-annotations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:simple-annotations [2016/05/13 11:15] mindplayrfc:simple-annotations [2016/05/14 11:13] mindplay
Line 83: Line 83:
 ==== Annotations are Context-free ==== ==== Annotations are Context-free ====
  
-By design, there is no access to variables in the parent class, file or global scope, no ''self'' or ''static'' or ''$this''.+By design, annotations expressions are evaluated individually in an empty scope - which means there is no access to variables in the parent class, file, local or global scope, e.g. no ''$this''''self'' or ''static''.
  
 Annotations work consistently regardless of which source element they are applied to, and may be evaluated without first creating an object instance. Annotations work consistently regardless of which source element they are applied to, and may be evaluated without first creating an object instance.
- 
-You can think of an annotation ''<< expression() >>'' as executing in an anonymous function scope, e.g.: 
- 
-    function () { return expression(); } 
  
 Annotations that do require context should explicitly ask for that context - for example, you could use an anonymous function, a ''callable'', or an anonymous class, 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 ''callable'', or an anonymous class, to provide context via dependency injection.
rfc/simple-annotations.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1