From b54e6564dade78d3cd673e4640a85c652d3ac656 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 27 Nov 2016 07:54:37 -0800 Subject: Don't throw when printing (sys:quasi . atom). We do not have perfect read/print consistency for quasiliterals. Programs can construct quasiliterals which cause the printer to throw exceptions, or which don't print such that the same object is read back. However, at least we can handle some trivial cases. In particular, the object (sys:quasi . #) occurs in the system, as the top-level binding of the quasi operator. With this change, we can print that instead of throwing. * lib.c (obj_print_impl): Check that a quasiliteral or quasi-list-literal is a list with at least one argument. Don't print (sys:quasi) or (sys:quasi . non-nil-atom) in the notation. --- lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib.c b/lib.c index 299263e6..ea16348c 100644 --- a/lib.c +++ b/lib.c @@ -9575,11 +9575,11 @@ val obj_print_impl(val obj, val out, val pretty, struct strm_ctx *ctx) put_string(lit("."), out); iter = next; } - } else if (sym == quasi_s) { + } else if (sym == quasi_s && consp(cdr(obj))) { put_char(chr('`'), out); out_quasi_str(obj, out, ctx); put_char(chr('`'), out); - } else if (sym == quasilist_s) { + } else if (sym == quasilist_s && consp(cdr(obj))) { val args = cdr(obj); put_string(lit("#`"), out); if (args) { -- cgit v1.2.3