summaryrefslogtreecommitdiffstats
path: root/stdlib
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-06-03 23:14:47 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-06-03 23:14:47 -0700
commitf73ef8182bebb9344d445edbb2f210ada03c8469 (patch)
tree78a4af63c8d8a56ae6cd90492d7fa4d8215d9978 /stdlib
parent42686f480eda0ddbae7d0b0ded84b6aabde1eb13 (diff)
downloadtxr-f73ef8182bebb9344d445edbb2f210ada03c8469.tar.gz
txr-f73ef8182bebb9344d445edbb2f210ada03c8469.tar.bz2
txr-f73ef8182bebb9344d445edbb2f210ada03c8469.zip
bug: compile-file can put out nil, confusing load.
The file compiler combines compiled forms into a single list as much as possible so that objects in the list can share structure (e.g. merged string literals). However, when package-manipulating forms occur, like defpackage, it has to spit these lists, since the package manipulations of an earlier form affect the processing of a later form, such as whether symbols in that form are valid. This splitting does not take care of the case that an empty piece may result when the very last form is a package manipulation form. A nil gets written to the .tlo file, which the load function does not like; load thinks that since this is not a valid list of compiled forms, it must be the version number field of a catenated .tlo file, and proceeds to find it an invalid, incompatible version. * stdlib/compiler.tl (dump-to-tlo): Use partition* rather than split*. partition* doesn't leave empty pieces.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/compiler.tl2
1 files changed, 1 insertions, 1 deletions
diff --git a/stdlib/compiler.tl b/stdlib/compiler.tl
index fd7b2017..62893e94 100644
--- a/stdlib/compiler.tl
+++ b/stdlib/compiler.tl
@@ -2448,7 +2448,7 @@
(defun dump-to-tlo (out-stream out)
(let* ((*print-circle* t)
(*package* (sys:make-anon-package))
- (out-forms (split* out.(get) (op where (op eq :fence)))))
+ (out-forms (partition* out.(get) (op where (op eq :fence)))))
(prinl %tlo-ver% out-stream)
[mapdo (op prinl @1 out-stream) out-forms]
(delete-package *package*)))