aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
diff options
context:
space:
mode:
authorIain Barnett <github@strachanclan.xyz>2019-08-17 14:24:45 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 14:24:45 +0900
commitdce1e14e80c9c6d1e25c8aaf9075c80df610ddc3 (patch)
treeab88c32f3c578fdba5230526f1589e5e4a3c5b2c /cont.c
parent28267cea083408185de3e0aaafd14ec76c9a3157 (diff)
downloadruby-dce1e14e80c9c6d1e25c8aaf9075c80df610ddc3.tar.gz
Use more different arguments in Fiber.yield documentation to make it clear (#2170)
https://github.com/ruby/ruby/pull/2170#issuecomment-489880700 Documentation is for those who don't know, remember, or understand (to any degree) the language, it should attempt to be clear above all other things. The example given is needlessly unclear because if you use a block it's common for arguments to be reused on every entry to the block. In Fiber's case this is not so. First time round 10 goes in, 12 comes out. Second time round 14 goes in, 14 comes out… was that because 14 is 12 + 2 or because it's "the return value of the call to Fiber.yield". It's the latter because it says so but why does the example need to make anyone think the former? Using different numbers makes it immediately clear what's happening whether the description is there or not.
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cont.c b/cont.c
index ae99a34531..da1075cfb0 100644
--- a/cont.c
+++ b/cont.c
@@ -1678,13 +1678,13 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
* end
*
* puts fiber.resume 10
- * puts fiber.resume 14
- * puts fiber.resume 18
+ * puts fiber.resume 1_000_000
+ * puts fiber.resume "The fiber will be dead before I can cause trouble"
*
* <em>produces</em>
*
* 12
- * 14
+ * 1000000
* FiberError: dead fiber called
*
*/