(1) The following expression generates the correct code:
(defun blah () (λ () (foo 123)))
But it also emits "Warning: Returning from unknown block NILBLOCK", which is undeserved.
(2) It's not clear how to do explicit return from a lambda now. That is,
(defun blah () (λ () (when (foo) (return 123)) ;; do some other stuff ))
generates the same warning as above. Is this just a bug, or is it suggesting that one must explicitly declare a scope using (BLOCK NIL...) in order to do an explicit return warning-free? I'm hoping not the latter.
I'm assuming λ is a macro that expands into a lambda that does (RETURN <something>).
Indeed I've changed RETURN to try to work like it does in CL. If there's no nil block it will still work, but issue a warning to encourage people to change their code.
An easy way to get around this warning in your case is to make λ wrap its body in a (block nil ...).
Vladimir
2010/12/6 Daniel Gackle danielgackle@gmail.com:
(1) The following expression generates the correct code: (defun blah () (λ () (foo 123))) But it also emits "Warning: Returning from unknown block NILBLOCK", which is undeserved. (2) It's not clear how to do explicit return from a lambda now. That is, (defun blah () (λ () (when (foo) (return 123)) ;; do some other stuff )) generates the same warning as above. Is this just a bug, or is it suggesting that one must explicitly declare a scope using (BLOCK NIL...) in order to do an explicit return warning-free? I'm hoping not the latter.
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
Oh, I'm sorry. I normally strip out any project-specific macro forms, but this time λ slipped through. It can just be replaced with LAMBDA in the examples I supplied. So I think your assumption is incorrect. In my example #1, the lambda doesn't explicitly return anything. Rather, it's the implicit return of (foo 123) that's causing the complaint. In other words, to get rid of the warning, you'd have to put a BLOCK NIL form at the start of every lambda, which is bad.
Can you either confirm that there is a bug as I described it, or that I got it wrong?
< Indeed I've changed RETURN to try to work like it does in CL. If there's no nil block it will still work, but issue a warning to encourage people to change their code. >
I'm a little unsure yet how this works in practice. I'll try compiling our code and looking at the generated output once the main bugs I reported have been fixed, and will report back with the details.
2010/12/8 Vladimir Sedach vsedach@gmail.com
I'm assuming λ is a macro that expands into a lambda that does (RETURN <something>).
Indeed I've changed RETURN to try to work like it does in CL. If there's no nil block it will still work, but issue a warning to encourage people to change their code.
An easy way to get around this warning in your case is to make λ wrap its body in a (block nil ...).
Vladimir
2010/12/6 Daniel Gackle danielgackle@gmail.com:
(1) The following expression generates the correct code: (defun blah () (λ () (foo 123))) But it also emits "Warning: Returning from unknown block NILBLOCK", which is undeserved. (2) It's not clear how to do explicit return from a lambda now. That is, (defun blah () (λ () (when (foo) (return 123)) ;; do some other stuff )) generates the same warning as above. Is this just a bug, or is it
suggesting
that one must explicitly declare a scope using (BLOCK NIL...) in order to do an explicit return warning-free? I'm hoping not the latter.
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
Can you either confirm that there is a bug as I described it, or that I got it wrong?
I'm positive you're doing a RETURN of something in the first example. Implicit returns don't generate that warning.
Vladimir
< Indeed I've changed RETURN to try to work like it does in CL. If there's no nil block it will still work, but issue a warning to encourage people to change their code. > I'm a little unsure yet how this works in practice. I'll try compiling our code and looking at the generated output once the main bugs I reported have been fixed, and will report back with the details.
2010/12/8 Vladimir Sedach vsedach@gmail.com
I'm assuming λ is a macro that expands into a lambda that does (RETURN <something>).
Indeed I've changed RETURN to try to work like it does in CL. If there's no nil block it will still work, but issue a warning to encourage people to change their code.
An easy way to get around this warning in your case is to make λ wrap its body in a (block nil ...).
Vladimir
2010/12/6 Daniel Gackle danielgackle@gmail.com:
(1) The following expression generates the correct code: (defun blah () (λ () (foo 123))) But it also emits "Warning: Returning from unknown block NILBLOCK", which is undeserved. (2) It's not clear how to do explicit return from a lambda now. That is, (defun blah () (λ () (when (foo) (return 123)) ;; do some other stuff )) generates the same warning as above. Is this just a bug, or is it suggesting that one must explicitly declare a scope using (BLOCK NIL...) in order to do an explicit return warning-free? I'm hoping not the latter.
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
You're absolutely right! We used to have a poor-man's implicit return before you added that feature to PS, and the definition of λ includes a vestige of it. Yikes, I'm surprised I didn't know that. Thanks for the help and sorry for the confusion.
I think the only bug preventing us from moving forward is the syntax error where THROW gets treated as an expression in a PROGN. Can you confirm (or deny :)) that one?
Daniel
2010/12/9 Vladimir Sedach vsedach@gmail.com
Can you either confirm that there is a bug as I described it, or that I got it wrong?
I'm positive you're doing a RETURN of something in the first example. Implicit returns don't generate that warning.
Vladimir
< Indeed I've changed RETURN to try to work like it does in CL. If there's no nil block it will still work, but issue a warning to encourage people to change their code. > I'm a little unsure yet how this works in practice. I'll try compiling
our
code and looking at the generated output once the main bugs I reported have been fixed, and will report back with the details.
2010/12/8 Vladimir Sedach vsedach@gmail.com
I'm assuming λ is a macro that expands into a lambda that does (RETURN <something>).
Indeed I've changed RETURN to try to work like it does in CL. If there's no nil block it will still work, but issue a warning to encourage people to change their code.
An easy way to get around this warning in your case is to make λ wrap its body in a (block nil ...).
Vladimir
2010/12/6 Daniel Gackle danielgackle@gmail.com:
(1) The following expression generates the correct code: (defun blah () (λ () (foo 123))) But it also emits "Warning: Returning from unknown block NILBLOCK", which is undeserved. (2) It's not clear how to do explicit return from a lambda now. That
is,
(defun blah () (λ () (when (foo) (return 123)) ;; do some other stuff )) generates the same warning as above. Is this just a bug, or is it suggesting that one must explicitly declare a scope using (BLOCK NIL...) in order to do an explicit return warning-free? I'm hoping not the latter.
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
parenscript-devel@common-lisp.net