summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-03-09 06:33:06 -0800
committerKaz Kylheku <kaz@kylheku.com>2018-03-09 06:33:06 -0800
commit07f130dd4f0a3a78a312c7b3dc14b0ae9e4049b3 (patch)
tree274e22b42df392304480797666d577e92650af37
parent55432c44257c340b7dc6ba565e49d6b584a9692c (diff)
downloadtxr-07f130dd4f0a3a78a312c7b3dc14b0ae9e4049b3.tar.gz
txr-07f130dd4f0a3a78a312c7b3dc14b0ae9e4049b3.tar.bz2
txr-07f130dd4f0a3a78a312c7b3dc14b0ae9e4049b3.zip
packages: drop no-fallback-list interning restriction.
Removing the restriction that qualified pkg:sym syntax may not cause interning to take place if pkg has a nonempty fallback list. This serves no purpose, only hindering the flexibility of the package system. * parser.y (sym_helper): When processing a qualified symbol, if the package exists, just intern it. * txr.1: Revise all text which touched on the removed rule, to remove all traces of it from the documentation.
-rw-r--r--parser.y15
-rw-r--r--txr.136
2 files changed, 7 insertions, 44 deletions
diff --git a/parser.y b/parser.y
index fadf1dcd..595bf8ff 100644
--- a/parser.y
+++ b/parser.y
@@ -1351,20 +1351,7 @@ static val sym_helper(parser_t *parser, wchar_t *lexeme, val meta_allowed)
pkg_name, sym_name, pkg_name, nao);
return nil;
}
-
- sym = find_symbol(sym_name, package);
-
- if (sym == zero) {
- if (!package_fallback_list(package)) {
- sym = intern(sym_name, package);
- } else {
- yyerrorf(scnr, lit("~a:~a: cannot intern symbol using qualified symbol syntax,"),
- pkg_name, sym_name, nao);
- yyerrorf(scnr, lit("~a:~a: because package ~a has a fallback list"),
- pkg_name, sym_name, pkg_name, nao);
- return nil;
- }
- }
+ sym = intern(sym_name, package);
}
} else {
val sym_name = string(lexeme);
diff --git a/txr.1 b/txr.1
index bf334df5..ad09a1e0 100644
--- a/txr.1
+++ b/txr.1
@@ -10861,10 +10861,7 @@ package.
It is a syntax error to read a symbol whose package doesn't exist.
If the package exists, but the symbol name doesn't exist in that package,
-the behavior depends on whether that package has a fallback list.
-If the package has an empty fallback list, then the symbol is interned in
-that package. If the package has non-empty fallback list, then the situation is
-a syntax error.
+then the symbol is interned in that package.
If the package name is an empty string (the colon is preceded by nothing), the
package is understood to be the
@@ -10917,8 +10914,6 @@ syntax does not intern the symbol
in the
.code foo
package; the symbol must exist or else the syntax is erroneous.
-In \*(TL, this strictness is only imposed if the package has a fallback
-list. If the package has an empty fallback list, the symbol will be interned.
.NP* Uninterned Symbols
@@ -45357,17 +45352,17 @@ and with the
.code :fallback
clause of the
.code defpackage
-macro. The fallback package list plays a role only in two situations
-in the \*(TL parser, one in the printer, and one in the interactive
+macro. The fallback package list plays a role only in three situations:
+one in the \*(TL parser, one in the printer, and one in the interactive
listener.
-The first parser situation involving a package fallback list occurs when the
+The parser situation involving the fallback list occurs when the
\*(TL parser resolves an unqualified symbol token: a symbol token not carrying
a package prefix. Such a symbol name is resolved against the current package
(the package currently stored in the
.code *package*
special variable). If a symbol matching the token
-is not found in the current package, then the packages in the fallback
+is not found in the current package, then the packages in its fallback
package list are searched for the symbol. The first matching symbol which is
found in the fallback list is returned. If no matching symbol is found in the
fallback list, then the token is interned as a new symbol is interned in the
@@ -45375,23 +45370,6 @@ current package. The packages in the current package's fallback list may
themselves have fallback lists. Those fallback lists are not involved; no such
recursion takes place.
-The second parser situation involving a package fallback list occurs when the
-\*(TL parser resolves a qualified symbol token. If a qualified symbol token
-refers to a nonexistent symbol (meaning that the denoted package exists, but
-has no such symbol) a check is performed whether the package has a non-empty
-fallback list. If a the package has a non-empty fallback list, then a syntax
-error occurs in this nonexistent symbol case. However, if the package has an
-empty fallback list, then the qualified symbol syntax is permitted to newly
-intern the nonexistent symbol in that package. For instance, the
-.code usr
-package has no fallbacks. Therefore the syntax
-.code usr:foobar
-will intern a symbol named
-.str foobar
-in the
-.code usr
-package and denote that symbol, rather than producing a syntax error.
-
The printer situation involving the fallback list is as follows.
If a symbol is being printed in a machine-readable way (not "pretty"),
has a home package and is not a keyword symbol, then a search takes place
@@ -45484,9 +45462,7 @@ in a private package.
;; Note that we don't have to change to the mod package,
;; to define functions with names in that package.
;; We rely on interning being allowed for the qualified
- ;; mod:priv-fun syntax, which is permitted because
- ;; mod has no fallback list. This is useful precisely
- ;; for this type of package.
+ ;; mod:public-fun syntax.
(defun mod:public-fun (arg)
(priv-fun arg)) ;; priv-fun here is mod-priv:priv-fun