Permalink
Browse files

Switched the precendence between rewrite rules (now higher probabilit…

…y) and

normal CL macro expansions.  This is the right thing to do because often Modf
needs to do something completely different (in fact the complete opposite) of
what a Lisp form would normally do.  So, rewrite rules now also allow for a way
to prevent normal macro expansion.
  • Loading branch information...
1 parent d75d5a0 commit 99057a8c4ead09d96fe53061c341dbc401880f29 @smithzvk committed Aug 28, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 modf.lisp
View
@@ -305,13 +305,14 @@ functions ahead of time."
(cond ((or (atom expr) (eql (car expr) 'modf-eval))
`(let ((,enclosed-obj-sym ,expr))
,new-val ))
- ((macro-function (car expr) env)
- (modf-expand new-val (funcall (macro-function (car expr) env) expr env)
- enclosed-obj-sym env))
;; First, try rewrite rules
((gethash (car expr) *modf-rewrites*)
(modf-expand new-val (funcall (gethash (car expr) *modf-rewrites*) expr)
enclosed-obj-sym env))
+ ;; expand it if it is a macro
+ ((macro-function (car expr) env)
+ (modf-expand new-val (funcall (macro-function (car expr) env) expr env)
+ enclosed-obj-sym env))
;; Okay, we are going to call modf-expand
(t (let* ((obj-sym (gensym))
(new-val (if enclosed-obj-sym

0 comments on commit 99057a8

Please sign in to comment.