[parenscript-devel] Bug: &optional arguments stay undefined when they shouldn't

Daniel Gackle danielgackle at gmail.com
Tue Sep 30 21:28:05 UTC 2008


PS' implementation of &optional function arguments breaks because of JS's
weird short-circuiting. For example,

(ps (defun blah (&optional (x 0))
        (return x)))
=> "function blah(x) {     x = undefined === x && 0 || x;     return x; };"

With this implementation, blah() is undefined when it should return 0.

A patch is below.

Daniel


hunk ./src/special-forms.lisp 268
-  `(setf ,place (or (and (=== undefined ,place) ,value)
-                 ,place)))
+  `(setf ,place (if (=== ,place undefined) ,value ,place)))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/parenscript-devel/attachments/20080930/9f23996a/attachment.html>


More information about the parenscript-devel mailing list