[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

generator documentation improvement

From: Paul Pogonyshev
Subject: generator documentation improvement
Date: Wed, 8 Mar 2017 21:47:43 +0100

I suggest the following short improvement to documentation of
generator functions.  It took me very long to understand what's wrong
with my code.

Problem can be illustrated with this:

(require 'generator)
(defvar xxx 0)
(iter-defun my-iter ()
  (print "A")
  (let ((xxx nil))
    (print "B")
    (iter-yield 0)
    (print "C"))
  (print "D"))
(iter-do (x (my-iter))
  (print x))

If you evaluate the last form, you'll see "B" and "C" printed twice
because `let' for dynamic variable is internally implemented with
something similar to `unwind-protect'. However, when documentation
doesn't mention it, that's very hard to pinpoint.


Attachment: generator-doc.diff
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]