summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-02-23 06:19:50 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-02-23 06:19:50 -0800
commit9a53386f3b8b6b41982decf162e4cd271d01ec97 (patch)
tree74085af7b6feefc200e1509f831b234f8bcbd53d /txr.c
parent6af39064ca9d9a78d0e12e64cb817f9080cf3793 (diff)
downloadtxr-9a53386f3b8b6b41982decf162e4cd271d01ec97.tar.gz
txr-9a53386f3b8b6b41982decf162e4cd271d01ec97.tar.bz2
txr-9a53386f3b8b6b41982decf162e4cd271d01ec97.zip
printer: revise package prefix decision.
* lib.c (symbol_needs_prefix): revisiting the wrongheaded requirements codified in 7bc150f, because the ergonomics is bad. In a package that has a local symbol that has the same name as one in a fallback list, that symbol is always printed with a prefix, which is annoying. The new rules are simple: if the symbol being printed is the one which is visible, then it gets no package prefix. Also, this function now handles the full responsibility for the prefix calculation, including for keyword symbols and uninterned symbools. It returns nil to indicate no prefix is needed, or else a character string. Moreover, logic is added to detect symbols which have a home package, but are uninterned from it, which should be printed with the "#" prefix. Lastly, this function is optimized to avoid unnecessary gethash operations. If a symbol S's home package is P, and P contains no hidden symbols (overwhelmingly common situation), then S is interned in P; no need to do the hash lookup to check this. (obj_print_impl): Symbol printing simplified: if symbol_needs_refix returns non-nil, that string value is the prefix.
Diffstat (limited to 'txr.c')
0 files changed, 0 insertions, 0 deletions