rfc:function_referencing

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:function_referencing [2014/08/03 14:58] – fixed link ajfrfc:function_referencing [2014/08/04 22:55] – Clarity for Danack :) ajf
Line 3: Line 3:
   * Date: 2014-08-03   * Date: 2014-08-03
   * Author: Andrea Faulds, ajf@ajf.me   * Author: Andrea Faulds, ajf@ajf.me
-  * Status: Draft+  * Status: Under Discussion
   * First Published at: http://wiki.php.net/rfc/function_referencing   * First Published at: http://wiki.php.net/rfc/function_referencing
  
Line 43: Line 43:
 $qux = new FooBar(3); $qux = new FooBar(3);
  
 +// Static functions referenced retain their scope
 $func = &FooBar::getStatic; $func = &FooBar::getStatic;
 +// Thus it can see the instance variables of $qux
 $func($qux); // 3 $func($qux); // 3
  
 $func = &FooBar::get; $func = &FooBar::get;
 $func->call($qux); // 3 $func->call($qux); // 3
 +
 +// Or, if we wish to bind
 +$func = Closure::bind(&FooBar::get, $qux);
 </code> </code>
  
Line 90: Line 95:
  
 A branch which implements this with a test which incorporates the Closure::call patch and is based on master can be found here: https://github.com/TazeTSchnitzel/php-src/compare/function_reference_with_apply A branch which implements this with a test which incorporates the Closure::call patch and is based on master can be found here: https://github.com/TazeTSchnitzel/php-src/compare/function_reference_with_apply
- 
-===== Implementation ===== 
-After the project is implemented, this section should contain  
-  - the version(s) it was merged to 
-  - a link to the git commit(s) 
-  - a link to the PHP manual entry for the feature 
  
 ===== References ===== ===== References =====
Line 101: Line 100:
   * [[https://en.wikipedia.org/wiki/First-class_function|First-class function - Wikipedia]]   * [[https://en.wikipedia.org/wiki/First-class_function|First-class function - Wikipedia]]
   * [[rfc:closure_apply|Closure::call RFC]]   * [[rfc:closure_apply|Closure::call RFC]]
- 
-===== Rejected Features ===== 
-Keep this updated with features that were discussed on the mail lists. 
rfc/function_referencing.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1