[Bese-devel] [PATCH] wrapping-standard method combination

Marco Baringer mb at bese.it
Sun Dec 4 16:26:03 UTC 2005


Vladimir Sekissov <svg at surnet.ru> writes:

> Good day,
> mb> > Other things I can do with other methods but wrapping methods seems
> mb> > for me the only right place for initialization.
> mb> 
> mb> then i think we wolud do better to _add_ something to wrapping
> mb> standard as opposed to changing the current evaluation order.
> mb> 
> mb> if you can think of a name for methods which wrap around sub class
> mb> methods and are not (in any way) overridable
>
> What about :wraparound.

This code:

(in-package :arnesi)

(defgeneric foo (a)
  (:method-combination wrapping-standard))

(defmethod foo ((a symbol))
  (write-line "primary"))

(defmethod foo :before ((a symbol))
  (write-line "before"))

(defmethod foo :after ((a symbol))
  (write-line "after"))

(defmethod foo :wrapping ((a symbol))
  (write-line "pre wrapping")
  (call-next-method)
  (write-line "post wrapping"))

(defmethod foo :wrap-around ((a symbol))
  (write-line "pre wrap-around")
  (call-next-method)
  (write-line "post wrap-around"))

Produces this output:

ARNESI> (foo 'a)
pre wrap-around
before
pre wrapping
primary
post wrapping
after
post wrap-around
"post wrap-around"
ARNESI> 

I'm not sure whether wrap-around's value should have been returned or
the primary method's, i decided to return wrap-around's value
(otherwise there's no good way to _not_ return wrap-around's value).

applied to arnesi_dev.

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen



More information about the bese-devel mailing list