Op 10-09-2023 om 16:46 schreef Maxim Cournoyer:
-          (force-output)))))
+(define (%load-announce file depth)
+  (when %load-verbosely
+    (with-output-to-port (current-warning-port)
+      (lambda ()
+        (let* ((pad-count (- 3 (string-length (number->string depth))))
+               (pad (if (> pad-count 0)
+                        (make-string pad-count #\space)
+                        ""))
+               (visual-depth (if (> pad-count 0)
+                                 (make-string depth #\space)
+                                 "")))
+          (format #t ";;; loading ~a~a ~a~a~%" pad depth visual-depth file)
+          (force-output))))))


I recommend removing that with-output-to-port and instead replace #t in (format #t ...) by (current-warning-port) and adding the relevant argument to force-output.

Sure, it probably usually won't matter much in practice, but who knows, maybe someone will do a system-async-mark (*) that happens to be run inside the with-output-to-port and which uses (current-output-port), in which case (with-output-to-port ...) would interfere.

(Note: if you do a system-async-mark that prints output, when possible I recommend that the interrupt procedure doesn't assume the port isn't temporarily changed.)

(*) Roughly similar to C signal handlers.

(I now see there is a v3, but the v3 does the same thing ...)

Best regards,
Maxime Devos.

Attachment: OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to