Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#180 uninterned symbols not shared between forms in FAS file

lisp error
open
Bruno Haible
clisp (525)
5
2003-11-06
2003-11-05
No

If a macro in a file generates a function
(or presumably some other top-level form)
with an uninterned symbol and this is used
in another form generated by the same macro,
the sharing is lost leading to an "undefined
function" exception:

This is on Clisp 2.31 (with my format extension).

To duplicate compile and load this file.
------------------------------------------
(in-package :user)

(defmacro make-func-var (name)
(let ((g (copy-symbol name)))
`(progn
(defun ,g () 42)
(defvar ,name #',g))))

(make-func-var v1)
------------------------------------------

GNU CLISP 2.31 (jtb 1) (released 2003-09-01) (built
3276804610) (memory 3277054578)
Features:
(CLOS LOOP COMPILER CLISP ANSI-CL COMMON-LISP LISP=CL
INTERPRETER SOCKETS
GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI UNICODE
BASE-CHAR=CHARACTER UNIX)
Installation directory:
/afs/cs.uwm.edu/package/clisp/clisp-2.31jbb1/sun4x_58/lib/clisp/
User language: ENGLISH

Discussion

  • Bruno Haible
    Bruno Haible
    2003-11-06

    Logged In: YES
    user_id=5923

    It's a long-standing bug. The workaround is to use
    "let()" or "locally" instead of "progn".

     
  • Sam Steingold
    Sam Steingold
    2003-11-06

    Logged In: YES
    user_id=5735

    The only way to fix this is to make sure that both defun and
    defvar are printed as a single lisp form into the .fas file.
    Bruno's workaround ensures that.
    The only real solution I can see is to create a per-.fas
    file circularity table (we cannot make the circularity table
    per compilation unit because the individual FAS components
    will stop being individually loadable).
    This approach would obviate the need for
    compiler::*load-forms* (which is also per-FAS file).
    Bruno, what do you think?

     
  • Sam Steingold
    Sam Steingold
    2003-11-06

    • assigned_to: sds --> haible
     
  • Sam Steingold
    Sam Steingold
    2010-08-11

    the problem with the per-FAS file circularity table is that to create it we need to compile the whole file _before_ writing _anything_.
    this would drastically increase the memory requirements for compilation.

     
  • Sam Steingold
    Sam Steingold
    2010-08-12

    Another problem with per-FAS file circularity table is that we will not be able to concatenate FAS files anymore because the #N# labels will collide.
    I guess we could offer a concatenate-fas-files function...

     
  • Sam Steingold
    Sam Steingold
    2010-08-12

    Yet another problem is that in clisp compile-file can take an open stream as the output-file argument; per-FAS file circularity table would have to be associated with the stream!