From: William H. N. <wil...@ai...> - 2001-05-25 16:40:49
|
On Thu, May 10, 2001 at 01:55:46AM +0200, Martin Atzmueller wrote: > attached is a patch for #'LOAD to take an additional external-format > keyword (as specified by ANSI), based on Raymond Toy's patch for CMUCL. ^^^^^^^^^^^^^^^^^^^^ ANSI does specify an EXTERNAL-FORMAT keyword argument, but as far as I can tell its intended semantics are different from what this patch does. I don't know why ANSI did this. I think it would be tidier if they'd specified a portable way to tell LOAD whether the data you're expecting is source or binary, but as far as I can see, they didn't. If you look at the definition for LOAD, you'll see that its EXTERNAL-FORMAT argument is supposed to have the same meaning as for OPEN, and refers to these glossary entries: external file format n. an object of implementation-dependent nature which determines one of possibly several implementation-dependent ways in which characters are encoded externally in a character file. external file format designator n. a designator for an external file format; that is, an object that denotes an external file format and that is one of: the symbol :default (denoting an implementation-dependent default external file format that can accomodate at least the base characters), some other object defined by the implementation to be an external file format designator (denoting an implementation-defined external file format), or some other object defined by the implementation to be an external file format (denoting itself). So it looks to me as though the intended values for EXTERNAL-FORMAT are things like '(UNSIGNED-CHARACTER 8): it's describing low-level representation of data, probably mostly for old-style typed filesystems, rather than high level interpretation of data. In practice, SBCL can probably get by without a disambiguating argument to LOAD. FASL files begin with the character sequence "# FASL", which can't appear at the beginning of a source file unless you've done nonstandard things to the readtable. So even if the rule about distinguishing files based on filetypes breaks down, we should be able to distinguish between valid input of the two types in all cases. (The current code doesn't necessarily, but if not, could be patched to do so.) If I'm mistaken about what the spec means, or about the difficulties of distinguishing filetypes, let me know. Otherwise, I'll probably make LOAD handle EXTERNAL-FORMAT just the same way as COMPILE-FILE does now, refusing any value other than :DEFAULT. -- William Harold Newman <wil...@ai...> "Incrementally extended heuristic algorithms tend inexorably toward the incomprehensible." -- http://www.unlambda.com/~james/lambda/lambda.txt PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C |