[Openmcl-devel] no-make-load-form-for foo

Gary Byers gb at clozure.com
Tue Oct 3 02:41:57 UTC 2006


At first glance, it sounds like a MAKE-LOAD-FORM method for EXTERNAL-FORMATs
isn't defined.  (If that's too easy, it's possible that the method is defined
somewhere, but there's a missing EVAL-WHEN somewhere ...)

To back up and review: a CL implementation has no idea of how to save a
structure or standard instance that's referenced as a constant in such a
way as to preserve its "identity", mostly because it has no notion of what
"identity" or "equality" means.  (Do EXTERNAL-FORMATs get "interned", so
that any attempt to create one with a given character encoding/line termination
convention always create the same one ?  If so, what it means to save one
to a file and re-create one when the compiled file is loaded might mean
something very different from what it would mean if this constraint was
not present, and COMPILE-FILE has no idea of what constraints do or do not
exist for a given class, and needs to be told.)

The means by which COMPILE-FILE is told how to save something in a way that
allows it to satisfy application-defined contstaints when it's loaded is by
means of the MAKE-LOAD-FORM method.  CL defines a standard function -
MAKE-LOAD-FORM-SAVING-SLOTS - which can be used in a MAKE-LOAD-FORM method
to simply save the values of the object's slots so that a vaguely similar
object can be created at load time.

To back up still further:  this issue matters when STANDARD-INSTANCEs and
structure instances are "referenced as constants" in code being compiled.
In a simple case:

(defconstant zero (- 1 1))

(defun foo (x) (= x zero))

most implementations will freely substitute the value of the constant for
references to it and compile the body of FOO as if it were written (= x 0).

That's not too controversial, but things can get more complicated when the
value of a named constant isn't of a type where "similarity as a constant"
doesn't necessarily mean EQ or EQL (the result of loading a constant from
a compiled file may not be EQ/EQL to the value of a named constant in
the runtime environment in which that file is loaded.)

If an implementation is aggressive about substituting the values of named
constants for references to them, then things like:

(eval-when (:compile-toplevel)
   (defconstant xxx ...))

(... xxx ...)

might "work", and the result of compiling code which references XXX can 
be loaded into an environment where XXX need not exist.  That's very
useful in some cases, but it's non-portable (since the compiler isn't
-required- to do any sort of substitution and since it's not even
specified whether the value of the named constant is determined at
compile-time or later.)

Being aggressive about constant substitution can lead to different
results than are obtained by being less agressive about it.  ANSI CL
permits a pretty wide range of compiler behavior in regards to
DEFCONSTANT, with one result being that it's harder to use DEFCONSTANT
portably than people sometimes assume.

OpenMCL's pretty aggressive about doing constant substitution, and the
whole point of this tangent is to note the possibility that:

(defconstant foo (make-external-format ...))

(... foo ...)

might lead to a situation where OpenMCL references an EXTERNAL-FORMAT object
as a constant (and therefore needs a MAKE-LOAD-FORM method for EXTERNAL-FORMAT)
where other implementations might not.


On Mon, 2 Oct 2006, [utf-8] Tiarnán Ã~S Corráin wrote:

> Hi-
>
> I'm trying to port chunga, by Edi Weitz (http://weitz.de/chunga) to
> OpenMCL, and am scratching my head at an error.  Error occurs when I
> try to compile streams.lisp, but does not happen when each of the
> forms in the file is evaluated separately.
>
> Backtrace from SLIME:
>
> No MAKE-LOAD-FORM method is defined for #<EXTERNAL-FORMAT (:ISO-8859-1
>                                                           :EOL-STYLE
>                                                           :LF) #x84C99DE>
> Backtrace:
>  0: (CCL::NO-MAKE-LOAD-FORM-FOR #<EXTERNAL-FORMAT (:ISO-8859-1 :EOL-STYLE :LF) #x84C99DE>)
>  1: (CCL::FASL-SCAN-USER-FORM 12)
>  2: (CCL::FASL-SCAN-GVECTOR '("Creates and returns a chunked stream (a stream of type
> CHUNKED-STREAM) which wraps STREAM.  STREAM must be an open
> binary stream."))
>  3: (CCL::FASL-SCAN "/Users/ocorrain/Lisp/site/chunga-0.1.2/streams.dfsl")
>  4: (CCL::FASL-SCAN-FORMS-AND-DUMP-FILE '((23 3) (47 "home:Lisp;site;chunga-0.1.2;streams.lisp") (4 #<Anonymous Function #x859D37E>) (4 #<Anonymous Function #x85969A6>) (4 #<Anonymous Function #x85A5F26>) (4 #<Anonymous Function #x85BF696>) (4 #<Anonymous Function #x85BDC4E>) (4 #<Anonymous Function #x85BAF36>) (4 #<Anonymous Function #x85B7B6E>) (4 #<Anonymous Function #x85B29CE>) ...) "/Users/ocorrain/Lisp/site/chunga-0.1.2/streams.dfsl" #<CCL::LEXICAL-ENVIRONMENT #x859F1BE>)
>  5: (CCL::%COMPILE-FILE "/Users/ocorrain/Lisp/site/chunga-0.1.2/streams.lisp" 'NIL 'NIL 'NIL 'T 'NIL 'T 'T 'NIL 'NIL ':DEFAULT '(#<RESTART CCL::RETRY-COMPILE-FILE #x14EFA3E> #<RESTART CCL::SKIP-COMPILE-FILE #x14EFA66>))
>  6: (COMPILE-FILE "/Users/ocorrain/Lisp/site/chunga-0.1.2/streams.lisp")
>
> -- 
> Tiarnán
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>


More information about the Openmcl-devel mailing list