On Wed, 2003-10-15 at 23:05, Raymond Toy wrote:
> 
> Michael Naunton wrote:
> > Thanks Alexey and Nicolas for your replies.
> > 
> > Deftransform is a thing of beauty.  I can now rip out hundreds of lines
> > of ugly code and replace them with the right thing.
> > 
> 
> I'd try compiler-macros before deftransform, since you're now making 
> your code non-portable.
> 
> Ray
> 

I'd like to use compiler-macros, but I don't immediately see how to
achieve this effect:


(defun op+ (x y)
  (list 'generic-op+ x y))

(c:defknown op+ (t t) t)
(c:deftransform op+ ((x y) (double-float double-float) t) '(+ x y))

(defun x1 (a) (declare (type double-float a)) (op+ a 4d0))
(defun x2 (a) (op+ a 4d0))

(compile 'x1)
(compile 'x2)

;; (list (x1 3d0) (x2 3d0))
;; ==>
;; (7.0d0 (generic-op+ 3.0d0 4.0d0))


-- Michael



Reply via email to