Incomplite sharp reader
vlad-km opened this issue · comments
vlad 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>
David Vázquez Púa commented
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*
.
David Vázquez Púa commented
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.
David Vázquez Púa commented
Found it 🙂 I opened a PR #356 with a fix.
vlad 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>
vlad 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>