Can't call a function named by a symbol created during macro expansion

Chaitanya Gupta via clisp-list <[email protected]> Mon, 27 Nov 2017 23:14:59 +0530
Newsgroups gmane.lisp.clisp.general
Message-ID <CANOhSrwaHTGSsw+sVvKpo-j+g-F88xX1KHxzxwpX+q95h3K3qw@mail.gmail.com>
metabang-bind is breaking for me on clisp[1]. I was able to reproduce
the problem using the following lisp code:

    ;; symbol-test.lisp
    (in-package "CL-USER")

    (defmacro generate (name)
      (let ((inner (gensym "INNER-")))
        `(progn
           (defun ,inner ()
             "INNER")
           (defun ,name ()
             (list (,inner))))))

    (generate outer)

Create a file called symbol-test.lisp and add the above code to it.

In clisp, if I just load the file, things work fine

    [1]> (load "symbol-test.lisp")
    ;; Loading file symbol-test.lisp ...
    ;; Loaded file symbol-test.lisp
    T
    [2]> (outer)
    ("INNER")

However if I try to compile and then load the file, calling OUTER
signals an exception:

    [1]> (load (compile-file "symbol-test.lisp"))
    ;; Compiling file /private/tmp/symbol-test.lisp ...
    ;; Wrote file /private/tmp/symbol-test.fas
    0 errors, 0 warnings
    ;; Loading file /private/tmp/symbol-test.fas ...
    ;; Loaded file /private/tmp/symbol-test.fas
    T
    [2]> (outer)

    *** - FUNCALL: undefined function #:INNER-8192
    The following restarts are available:
    USE-VALUE      :R1      Input a value to be used instead of
(FDEFINITION '#:INNER-8192).
    RETRY          :R2      Retry
    STORE-VALUE    :R3      Input a new value for (FDEFINITION '#:INNER-8192).
    ABORT          :R4      Abort main loop

In other Lisps that I have tested, compiling and then loading the file
works just fine.

Is this a bug in clisp?

Chaitanya

1. https://github.com/gwkkwg/metabang-bind/issues/11

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list