summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-04-14 23:15:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-04-14 23:15:38 -0700
commit5947a426342c513a6155c65b393b961d23a57f2a (patch)
tree01cb521a1172589ca547def9e3ca9fc9753ade6c
parent3fb45800ebfcc5274c845a10d2f0d85b1024a8b6 (diff)
downloadtxr-5947a426342c513a6155c65b393b961d23a57f2a.tar.gz
txr-5947a426342c513a6155c65b393b961d23a57f2a.tar.bz2
txr-5947a426342c513a6155c65b393b961d23a57f2a.zip
special-operator-p: don't report error entries as t.
* eval.c (special_operator_p): Do not return t for certain symbols that are wired to error-throwing functions in the table, whose purpose it is to detect certain unexpanded syntax that is handled internally by the expander. * txr.1: Documentation udpated in several places to clarify that certain operators are not special operators. Also expander-let is reclassified from Macro to Ooerator.
-rw-r--r--eval.c16
-rw-r--r--txr.132
2 files changed, 46 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index aaac3513..517e7ff6 100644
--- a/eval.c
+++ b/eval.c
@@ -6300,7 +6300,21 @@ val mboundp(val sym)
val special_operator_p(val sym)
{
- return if2(gethash(op_table, sym), t);
+ val fun = gethash(op_table, sym);
+
+ if (fun) {
+ opfun_t fp = coerce(opfun_t, cptr_get(fun));
+
+ if (fp == op_error || fp == op_meta_error ||
+ fp == op_qquote_error || fp == op_unquote_error)
+ {
+ return nil;
+ }
+
+ return t;
+ }
+
+ return nil;
}
static val makunbound(val sym)
diff --git a/txr.1 b/txr.1
index 22b65d6b..016861a1 100644
--- a/txr.1
+++ b/txr.1
@@ -20497,6 +20497,21 @@ if
is a symbol which names a special operator, otherwise it returns
.codn nil .
+Certain operator symbols are not understood as special operators,
+and not reported as such by this function.
+
+The operators
+.codn macrolet ,
+.code symacrolet
+and
+.code expander-let
+are completely consumed by the macro expander, and do not appear
+in its output. Therefore they are never seen by evaluation or compilation
+and are not special operators for that reason.
+
+The unquoting and splicing operators in quasiquote syntax also aren't special
+operators. They are a notation recognized by the quasiquoting macro.
+
.coNP Symbol Macro @ %fun%
.desc
The symbol macro
@@ -42436,6 +42451,11 @@ When another macro is tried, the process repeats, resulting in a search which
proceeds as far as possible through outer lexical scopes and finally the
global scope.
+The
+.code symacrolet
+symbol isn't a special operator, and is not reported as such by
+.codn special-operator-p .
+
.coNP Function @ macro-form-p
.synb
.mets (macro-form-p < obj <> [ env ])
@@ -43324,6 +43344,11 @@ applies inside a
form. Lexical operator macros do not shadow
symbol macros under any circumstances.
+The
+.code symacrolet
+symbol isn't a special operator, and is not reported as such by
+.codn special-operator-p .
+
.coNP Macros @ placelet and @ placelet*
.synb
.mets (placelet >> ({( sym << place )}*) << body-form *)
@@ -43465,7 +43490,7 @@ emanating from the
.code delta
form.
-.coNP Macro @ expander-let
+.coNP Operator @ expander-let
.synb
.mets (expander-let >> ({( sym << init-form )}*) << body-form *)
.syne
@@ -43519,6 +43544,11 @@ A macro may generate an
.code expander-let
form in order to communicate values to macros contained in that form.
+The
+.code expander-let
+symbol isn't a special operator, and is not reported as such by
+.codn special-operator-p .
+
.coNP Macro @ macro-time
.synb
.mets (macro-time << form *)