Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature testing not work as intended at compile time #474

Open
VitoVan opened this issue Apr 21, 2023 · 1 comment
Open

feature testing not work as intended at compile time #474

VitoVan opened this issue Apr 21, 2023 · 1 comment

Comments

@VitoVan
Copy link
Contributor

VitoVan commented Apr 21, 2023

(defpackage :common-lisp-user)

#+jscl
(defun hello ()
  (format t "Hello, yes JSCL ~%"))

#-jscl
(defun hello ()
  (format t "Hello, no JSCL ~%"))

(hello)

This piece of code should output "Hello, yes JSCL", right?

But after compiling, it output "Hello, no JSCL".

sbcl --load jscl.lisp --eval '(jscl:bootstrap)' --eval '(jscl:compile-application (list "feature-test.lisp") "main.js")' --eval '(quit)'

imagen

Is this a bug?

I wish to use the same Lisp code to compile on different platforms, like SBCL and ECL and JSCL, how to detect JSCL at compile time?

@VitoVan
Copy link
Contributor Author

VitoVan commented Apr 21, 2023

Here is a workaround:

sbcl --load jscl.lisp --eval '(jscl:bootstrap)' \
     --eval '(pushnew :jscl *features*)' \
     --eval '(jscl:compile-application (list "feature-test.lisp") "main.js")' \
     --eval '(quit)'

I don't know if it has any side-effects, but it seems to be working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant