From 96b15f85c3e0ff293cf85dd818967be231d879d5 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 22 Jan 2021 19:00:20 -0800 Subject: 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. --- share/txr/stdlib/match.tl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'share') 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) -- cgit v1.2.3