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

Incomplite sharp reader

vlad-km opened this issue · comments

commented

SBCL

CL-USER> (let ((str "#+nil bar baz"))
 (print (read-from-string str))
 (let ((*features* (cons :nil *features*)))
  (print (read-from-string str))
  (values)))

BAZ 
BAR 
; No value
CL-USER>

JSCL

CL-USER> (let ((str "#+nil bar baz"))
 (print (read-from-string str))
 (let ((*features* (cons :nil *features*)))
  (print (read-from-string str))
  (values)))

BAZ
BAZ
CL-USER>

Not related to this, but I also found that #+ will only work for keywords, but the hyperspec says it should work regardless of the package of the symbols in *features*.

Interestingly, it seems to work when done in two statements:


CL-USER> (push :nil *features*)
(:NIL :MOP :JSCL :COMMON-LISP)
CL-USER> (read-from-string "#+nil bar baz")
BAR
NIL

which is pretty weird.

Found it 🙂 I opened a PR #356 with a fix.

commented

Yes!

CL-USER> (let ((str "#+nil bar baz")) 
  (print (read-from-string str)) 
  (let ((*features* (cons :nil *features*))) 
   (print (read-from-string str)) 
   (values))) 
 
BAZ
BAR
CL-USER> 
commented
CL-USER> #+(and mop node) (print 'present)
PRESENT
PRESENT
CL-USER> #+(and mop node cl) (print 'present)
ERROR: End of file
CL-USER> #+(or cl mop node) (print 'present)
PRESENT
PRESENT
CL-USER> (let ((*features* (cons :cl *features*))) 
... #+(and mop node cl) (print 'yes))
NIL
CL-USER> (let ((*features* (cons :cl *features*))) 
... #+(or cl mop node ) (print 'yes))
YES
YES
CL-USER> (let ((*features* (cons :cl *features*))) 
... (print *features*) 
... #+(and mop node cl) (print 'yes))
(:CL :NODE :MOP :JSCL :COMMON-LISP)
(:CL :NODE :MOP :JSCL :COMMON-LISP)
CL-USER> (let ((*features* (cons :cl *features*))) 
... (print *features*) 
... #+(and cl mop node) (print 'yes))
(:CL :NODE :MOP :JSCL :COMMON-LISP)
(:CL :NODE :MOP :JSCL :COMMON-LISP)
CL-USER> (let ((*features* (cons :cl *features*))) 
... (print *features*) 
... #+(or cl mop node) (print 'yes))
(:CL :NODE :MOP :JSCL :COMMON-LISP)
YES
YES
CL-USER>