rfc:fiber
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:fiber [2018/04/17 23:00] – lvht | rfc:fiber [2018/06/12 07:40] (current) – move back to discussion krakjoe | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Version: 0.1 | * Version: 0.1 | ||
* Date: 2017-09-13 | * Date: 2017-09-13 | ||
- | * Author: Haitao Lv< | + | * Author: Haitao Lv< |
* Status: Under Discussion | * Status: Under Discussion | ||
* First Published at: http:// | * First Published at: http:// | ||
Line 63: | Line 63: | ||
=== Usage Demo === | === Usage Demo === | ||
- | Here is the usage demo, | ||
<code php> | <code php> | ||
function sub1() | function sub1() | ||
Line 82: | Line 81: | ||
=== Implementation Detail === | === Implementation Detail === | ||
+ | In our simple implementation, | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 107: | Line 107: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
- | < | + | < |
- | </ | + | Martin Schröder is working on this at https:// |
- | Fiber does not support yielding during | + | And here is the comparison. |
+ | ^Property^Stackless | ||
+ | |1 Minimum Memory Usage|VM stack only (4 KB)|VM & C stack (4 KB + 4 KB)| | ||
+ | |2 Supported Architecturs|any platform|x86 at this time| | ||
+ | |3 Yield in Internal Function|unsupported|supported| | ||
+ | |4 Yield in Iterator|unsupported|supported| | ||
- | < | + | Stackless |
- | Offering methods like < | + | Native fibers are very platform-dependend |
- | < | + | < |
- | The Fiber:: | + | And as a language feature, |
- | < | + | < |
- | Both Ruby's Fiber and Lua's coroutine using the **resume()** API to **init** and **resume** their coroutine. There is no need to offer a **dedicate init** API. | + | Both Ruby's Fiber and Lua's coroutine using the same **resume()** API to **init** and **resume** their coroutine. |
- | + | ||
- | < | + | |
- | + | ||
- | You will get a Fatal Error like | + | |
- | + | ||
- | Fatal error: Uncaught Error: Cannot call Fiber:: | + | |
- | + | ||
- | < | + | |
- | + | ||
- | Introducing new keywords like await/emit does not offer any essential benefit but only cause BC impact. | + | |
- | + | ||
- | Both Ruby's Fiber and Lua's coroutine use method to pause and resume their coroutine. There is no need to introduce new keyword. | + | |
===== Unaffected PHP Functionality ===== | ===== Unaffected PHP Functionality ===== | ||
Line 140: | Line 133: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | This sections details areas where the feature might be improved in future, but that are not currently proposed in this RFC. | ||
- | ===== Proposed Voting Choices ===== | + | Syntax like async/await can be implemented in the future, but it's out of the scope of this RFC. |
- | 2/3+1 voting majority | + | |
===== Patches and Tests ===== | ===== Patches and Tests ===== |
rfc/fiber.1524006002.txt.gz · Last modified: 2018/04/17 23:00 by lvht