doublep / iter2

Reimplementation of Elisp generators
GNU General Public License v3.0
9 stars 3 forks source link

`iter-yield` inside `dolist` crashes `iter2--convert-function-body` when defining function #2

Closed rhaps0dy closed 2 years ago

rhaps0dy commented 2 years ago

To reproduce, on master, eval:

(iter2-defun f ()
  (dolist (e '(1 2 3))
    (iter-yield e)))

which gives error wrong-type-argument listp $value. Fair enough.

Mysteriously, however, macroexpanding the above is fine:

(macroexpand '(iter2-defun f ()
  (dolist (e '(1 2 3))
    (iter-yield e))))

gives no error.

I don't know how to start fixing this, since macroexpand works just fine.

doublep commented 2 years ago

Works for me:

~/iter2$ eldev eval "(iter2-defun f () (dolist (e '(1 2 3)) (iter-yield e)))" "(iter-do (k (f)) (print k))"
f

1

2

3
nil

Also works inside Emacs. Which Emacs version do you use?

rhaps0dy commented 2 years ago

I use Emacs 29.0.50, which is the master from a few weeks ago. It works for me too now. I must have evaled something that made this go wrong in my old Emacs session, and I did not restart it and try again when submitting the issue.

I'm very sorry about wasting your time, I'll do better next time.

doublep commented 2 years ago

I must have evaled something that made this go wrong in my old Emacs session

That's why I prefer to use eldev (or emacs --batch) for reproducing bugs: you always get a fresh and standardized evaluation environment.