diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2019-02-05 04:05:26 -0800 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-05 13:05:26 +0100 |
commit | 2b30998159987dc0bd93e4b88421743dac8f76d6 (patch) | |
tree | 479259e62c2bb81518ce708be8ef9eb75d97541f /doc/manual.rst | |
parent | 824f39b32e04e31514aade50da38516b8fadac12 (diff) | |
download | Nim-2b30998159987dc0bd93e4b88421743dac8f76d6.tar.gz |
document that multiple `yield` in inline iterator cause code bloat (#10553)
* document that multiple `yield` in inline iterator cause code duplication * doc: rule `Start types with a capital T` was deprecated
Diffstat (limited to 'doc/manual.rst')
-rw-r--r-- | doc/manual.rst | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/doc/manual.rst b/doc/manual.rst index bcb1581dd..e06192780 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -3870,7 +3870,14 @@ First class iterators There are 2 kinds of iterators in Nim: *inline* and *closure* iterators. An `inline iterator`:idx: is an iterator that's always inlined by the compiler leading to zero overhead for the abstraction, but may result in a heavy -increase in code size. Inline iterators are second class citizens; +increase in code size. + +Caution: the body of a for loop over an inline iterator is inlined into +each ``yield`` statement appearing in the iterator code, +so ideally the code should be refactored to contain a single yield when possible +to avoid code bloat. + +Inline iterators are second class citizens; They can be passed as parameters only to other inlining code facilities like templates, macros and other inline iterators. |