summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-03 20:36:23 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-03 20:36:23 -0700
commit7bc150f6d87b836b7690f8d73ee815ea8c718b13 (patch)
treecfd00d9675a70a46b512616483c1741d68b8fb47 /lib.h
parent3ce8999b2cc9c2aa04805141af9cb449d92fa89e (diff)
downloadtxr-7bc150f6d87b836b7690f8d73ee815ea8c718b13.tar.gz
txr-7bc150f6d87b836b7690f8d73ee815ea8c718b13.tar.bz2
txr-7bc150f6d87b836b7690f8d73ee815ea8c718b13.zip
packages: fix package prefix read/print issue.
Suppose that we have two symbols of the same name, in two packages: foo:sym and bar:sym. Suppose that the bar package has foo in its package fallback list, and suppose bar is the current package. Then bar:sym prints without a package prefix, as just sym. However, this is potentially ambiguous. Suppose that bar:sym is written to a file as just sym. Then later the file is read into a fresh image in a situation in which bar:sym has not yet been interned, but foo:sym already exists. In this situation, sym will just resolve to foo:sym. The printer must detect this ambiguous situation. If a symbol is present in a package, but a same-named symbol is in the fallback list; or if a symbol is visible in the fallback list, but a same-named symbol is present in the package, then a package prefix should be printed. * lib.c (symbol_needs_prefix): New function. (unquote_star_check, obj_print_impl): Use symbol_needs_prefix rather than symbol_visible. * lib.h (symbol_needs_prefix): Declared.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib.h b/lib.h
index f39f075a..6fe29fe2 100644
--- a/lib.h
+++ b/lib.h
@@ -843,6 +843,7 @@ val unuse_sym(val symbol, val package);
val use_package(val use_list, val package);
val unuse_package(val unuse_list, val package);
val symbol_visible(val package, val sym);
+val symbol_needs_prefix(val package, val sym);
val find_symbol(val str, val package);
val intern(val str, val package);
val unintern(val sym, val package);