jscl-project / jscl

A Lisp-to-JavaScript compiler bootstrapped from Common Lisp

Home Page:https://jscl-project.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

default key values bug

hemml opened this issue · comments

commented

SBCL:

(defun test (x y z)
  (funcall
    (lambda (&key (x x) (y y) (z z))
      (format t "X: ~A, Y: ~A, Z: ~A~%" x y z))
    :x 'x1))
(test 'x 'y 'z)
X: X1, Y: Y, Z: Z

In JSCL:

(defun test (x y z) 
...   (funcall 
...     (lambda (&key (x x) (y y) (z z)) 
...       (format t "X: ~A, Y: ~A, Z: ~A~%" x y z)) 
...     :x 'x1))
TEST
CL-USER> (test 'x 'y 'z)
X: X1, Y: #<JS-OBJECT undefined>, Z: #<JS-OBJECT undefined>

but the following code works:

(defun test (x1 y1 z1) 
...   (funcall 
...     (lambda (&key (x x1) (y y1) (z z1)) 
...       (format t "X: ~A, Y: ~A, Z: ~A~%" x y z)) 
...     :x 'x1))
CL-USER> (test 'x 'y 'z)
X: X1, Y: Y, Z: Z 
commented

now is called on the stage equwal
he knows exactly how that mistakes to correct

wbr
@vlad-km