rfc:true-nested-function-support
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:true-nested-function-support [2011/07/18 12:23] – created rune | rfc:true-nested-function-support [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Request for Comments: | + | ====== Request for Comments: |
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2011-06-18 | * Date: 2011-06-18 | ||
Line 13: | Line 13: | ||
* If the parent function is called twice they will be defined twice and thus give a fatal error. | * If the parent function is called twice they will be defined twice and thus give a fatal error. | ||
- | This is how it is possible to implemented nested functions today: | + | ===== Code examples ===== |
- | 1) Extending | + | ====== |
+ | <code php> | ||
+ | function _prefix_functionname_helperfunctionname($arg1, | ||
+ | ; | ||
+ | } | ||
+ | |||
+ | function prefix_functionname() { | ||
+ | // Code here... | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ====== 2) Appending | ||
<code php> | <code php> | ||
function prefix_functionname() { | function prefix_functionname() { | ||
Line 28: | Line 40: | ||
</ | </ | ||
- | 2) Using closures. | + | ====== 3) Using closures |
<code php> | <code php> | ||
function prefix_functionname() { | function prefix_functionname() { | ||
- | | + | |
+ | ; | ||
} | } | ||
// Code here... | // Code here... | ||
- | | + | somefunc($innerfunctionname($arg1, |
} | } | ||
</ | </ | ||
- | + | ====== 4) Using new syntax ====== | |
+ | <code php> | ||
+ | function prefix_functionname() { | ||
+ | | ||
+ | ; | ||
+ | } | ||
+ | // Code here... | ||
+ | | ||
+ | } | ||
+ | </ | ||
===== Todo for this RFC ===== | ===== Todo for this RFC ===== | ||
- | * Write little script that checks for use of internal | + | * Write little script that checks for the current |
rfc/true-nested-function-support.1310991838.txt.gz · Last modified: 2017/09/22 13:28 (external edit)