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

Function EXPORT not working as expected while compiling. #471

Open
VitoVan opened this issue Apr 20, 2023 · 0 comments
Open

Function EXPORT not working as expected while compiling. #471

VitoVan opened this issue Apr 20, 2023 · 0 comments

Comments

@VitoVan
Copy link
Contributor

VitoVan commented Apr 20, 2023

Sample code:

(defpackage :common-lisp-user)

(defpackage :c
  (:use cl)
  (:export
   :hello
   ))

(in-package :c)

(defun hello ()
  (#j:console:log "Hello"))

(defun hey ()
  (#j:console:log "Hey"))

(export 'hey)

(in-package :cl-user)

(c:hello)
(c:hey)

As we can see, this piece of code exports two functions, one is hello the other is hey.

This piece of code work as intended in the REPL:

imagen

But while I tried to compile it:

sbcl --load jscl.lisp \
     --eval '(jscl:bootstrap)' \
     --eval '(jscl:compile-application (list "~/source/test-export.lisp") "~/source/test-export.js")' \
     --eval '(quit)'

Something weird will happen:

Compiling ~/source/test-export.lisp...

debugger invoked on a SIMPLE-ERROR in thread
#<THREAD "main thread" RUNNING {10010A8073}>:
  The symbol `"HEY"' is not external in the package #<PACKAGE "C">.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Ignore runtime option --eval "(jscl:compile-application (list \"~/source/test-export.lisp\") \"~/source/test-export.js\")".
  1: [ABORT   ] Skip rest of --eval and --load options.
  2:            Skip to toplevel READ/EVAL/PRINT loop.
  3: [EXIT    ] Exit SBCL (calling #'EXIT, killing the process).

(JSCL::READ-SYMBOL "c:hey")
   source: (ERROR "The symbol `~S' is not external in the package ~S." NAME
                  PACKAGE)
0]
*

I think it should be confident to treat this as a bug, so I post it here as an issue (instead of a discussion).

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