[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: uninterned symbols and the compiler



The KCL file compiler does have some problems with uninterned symbols
and with data that has unusual read or print characteristics in general.

For example, the following program works in Lucid Lisp but not in KCL:

    (defmacro define-lock-and-key ()
      (let ((gen (gensym)))
	`(progn
	   (defun key () ',gen)
	   (defun lock (key?)
	     (member key? '(,gen))))))

    (define-lock-and-key)

The problem is that the ".data" file looks like this:

    #(
    lisp::progn
    lisp::defun
    user::key
    lisp::quote
    user::lock
    (user::key?)
    lisp::member
    user::key?
    #:g826
    (#:g826)
    user::define-lock-and-key
    )

The #:g826 appears twice and so is read as two separate symbols with
the same name.

Note that the #:g826 symbol would have appeared once if LOCK had been
defined by

    (defun lock (key?)
      (eq key? ',gen))

This means that rather subtle changes can cause code to stop working.

Jeff Dalton,                      JANET: J.Dalton@uk.ac.ed             
AI Applications Institute,        ARPA:  J.Dalton%uk.ac.ed@nss.cs.ucl.ac.uk
Edinburgh University.             UUCP:  ...!ukc!ed.ac.uk!J.Dalton