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

+INTERNAL-STRING-MARKER lossage



    ;; Intern the ``string'' MY-BUG ... 
    (EVAL-WHEN (EVAL COMPILE) (INTERN "MY-BUG"))
    ;; Define an ordinary function ...
    (DEFUN MY-BUG (X) X)

-----
This works niftily in the interpreter. This doesn't work if you try to compile
and fasload it into a lisp. I wonder why? Could it have anything to do with 
the +INTERNAL-STRING-MARKER that is still on the *interned* symbol in the 
compiler after the (INTERN "MY-BUG") is executed? Probably. I think that 
probably the compiler should also redefine INTERN to do a normal intern only 
if that property is absent. Presumably if the property is present, you 
should treat the symbol as a string. What does that mean? Well, how about...

    (DEFUN REDEFINED-INTERN (X)
	   (COND ((AND (SYMBOLP X) (GET X '+INTERNAL-STRING-MARKER))
		  (STANDARD-INTERN (COPYSYMBOL X ()))) ; Don't copy plist!!
		 (T
		  (STANDARD-INTERN X))))

ie, if the thing has such a marker, it's a string. strings cannot live on the
obarray, so get a symbol which looks like the string and put *that* on the
obarray... if you don't do something like this, the result is confusing. it
lost me about 2 hours last night trying to find out why my function ran
interpreted but lost compiled ... disappeared. the UNFASL file even claims that
the function is getting defined...

-kmp