Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert LET layer into TAGBODY to prevent to capture loop variables directly #1

Closed
ichimal opened this issue Sep 7, 2012 · 0 comments
Assignees
Labels

Comments

@ichimal
Copy link
Owner

ichimal commented Sep 7, 2012

On current impl has capturing-loop-variable problem as below.

(mapcar #'funcall
  (local-function fun ((x 3) acc)
    (when (plusp x)
      (no-return (fun
                           (1- x)
                           (cons (lambda () x) ; <- this is problem
                                      acc ))))
    acc )))

; => (0 0 0) ; sholud be (1 2 3)

Fix it.

@ghost ghost assigned ichimal Sep 7, 2012
@ichimal ichimal closed this as completed in f795b0e Sep 8, 2012
ichimal added a commit that referenced this issue Sep 11, 2012
Fix handling declarations with arguments of local function.

And now, there is an new problem around IGNORE/IGNORABLE declaration.

For this commit version of local-function,

    (local-function fun ((v1 ...) (v2 ...) ... (vk ...) vn)
      (declare (type fixnum v1 v2 ... vk) (ignore vn))
      ... )

above code will be expanded to below;

    (labels ((fun (#1=#:G1 #2=#:G2 ... #k=#:Gk #n=#:Gn)
               (declare (type fixnum #1# #2# ... #k#)
                        (ignore #n#) )
               (block fun
                 (tagbody #s=#:start-tag
                   (let ((v1 #1#) (v2 #2#) ... (vk #k#)
                         (vn #n#) )
                     (declare (type fixnum v1 v2 ... vk) (ignore vn))
                     ... )))))
      (fun ...) )

initial value of a following LET variable vn.
This is problem.

close #2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant