diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-01-22 19:00:20 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-22 19:00:20 -0800 |
commit | 96b15f85c3e0ff293cf85dd818967be231d879d5 (patch) | |
tree | 66abecdbe38d0dcb45823bf4a5b75c5803440467 | |
parent | 7af73f4d549a25b41e8278a3a26bed3603e31bc1 (diff) | |
download | txr-96b15f85c3e0ff293cf85dd818967be231d879d5.tar.gz txr-96b15f85c3e0ff293cf85dd818967be231d879d5.tar.bz2 txr-96b15f85c3e0ff293cf85dd818967be231d879d5.zip |
matcher: bugfix: boostrapping chicken-egg-problem.
The previous commit made the general pattern matcher dependent
on calling non-triv-pat-p function. But that function needs
the matcher to work in order to be defined. This has left the
code base uncompilable.
* share/txr/stdlib/match.tl (non-triv-pat-p): Precede the
real definition of non-triv-pat-p with a temporary one which
returns a conservative t value, which suspects all syntx to
be non-trivial. This means that the real non-triv-pat-p can
use match-case, because match-case's expander will be using
the temporary version of the function. non-triv-pat-p won't
benefit from the optimizations arising from identifying
trivial patterns: but since it doesn't have any such patterns,
so it makes no difference.
-rw-r--r-- | share/txr/stdlib/match.tl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/share/txr/stdlib/match.tl b/share/txr/stdlib/match.tl index 8268f0a7..af85ef8c 100644 --- a/share/txr/stdlib/match.tl +++ b/share/txr/stdlib/match.tl @@ -461,6 +461,8 @@ ^(defun ,name (. ,args) (match-case ,args ,*clauses)))) +(defun non-triv-pat-p (syntax) t) + (defun non-triv-pat-p (syntax) (match-case syntax ((@(op eq 'sys:expr) (@(bindable) . @nil)) t) |