From: ···············@gmail.com
Subject: describe-object only for a list of objects
Date: 
Message-ID: <ff0421a9-4fe6-4915-b890-f7a5283d3ada@s1g2000prg.googlegroups.com>
I have specified describe-object to some object type to describe the
object in some html-fied manner

(defmethod describe-object ((integer-line yawn-war::integer-line)
stream)
  (cl-who:with-html-output
   ((:ul)
    (loop for class-slot in (sb-mop:class-slots (class-of integer-
line))
       for name = (sb-mop:slot-definition-name class-slot)
       for val = (slot-value integer-line name)
       do
	 (cl-who:htm
	  ((:li)
	   (cl-who:fmt "~s" name) ":=" (cl-who:fmt "~s" val)))))))

run (describe o) and if o is a integer-line print with html else do
the standard describe. Works like a charm.
However, I would like to extend this definition to a list of objects
(defparameter *describe-object-as-html* '(yawn-war::integer-line other-
object))
i.e. if the object is in *describe-object-as-html* describe object
with html tags, else just use normal describe.
If there were some next-method something like this could work:
(defmethod describe-object ((object t) stream)
  (if (member object *describe-object-as-html*)
      "do with html tags"
      (next-method) ;; else just use plain old standard describe
  ))

any hints?
thanx
olivier buecel

From: Thomas A. Russ
Subject: Re: describe-object only for a list of objects
Date: 
Message-ID: <ymi63ksbcwf.fsf@blackcat.isi.edu>
···············@gmail.com writes:

> I have specified describe-object to some object type to describe the
> object in some html-fied manner
...
> However, I would like to extend this definition to a list of objects
> (defparameter *describe-object-as-html* '(yawn-war::integer-line other-
> object))
> i.e. if the object is in *describe-object-as-html* describe object
> with html tags, else just use normal describe.
> If there were some next-method something like this could work:
> (defmethod describe-object ((object t) stream)
>   (if (member object *describe-object-as-html*)
>       "do with html tags"
>       (next-method) ;; else just use plain old standard describe
>   ))


Well, there is CALL-NEXT-METHOD, but that won't work if you end up
redefining the method on the topmost object T.  There isn't any next
method because you've replaced it.

There are a couple of potential solutions:

(1)  Use an :AROUND method on DESCRIBE-OBJECT which can then choose to
     CALL-NEXT-METHOD or not.

(2)  [Better].  Write your own printing method and specialize it as
     desired for various types.  Of course, this means that you would
     have to handle printing of CONS, VECTOR, etc. yourself, but that
     does give you the most control.  And it also isolates you from
     interference with other code.


-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: ···············@gmail.com
Subject: Re: describe-object only for a list of objects
Date: 
Message-ID: <e62f6059-1def-45e9-848d-18093a27c7b9@v5g2000prm.googlegroups.com>
On Jan 6, 5:46 pm, ····@sevak.isi.edu (Thomas A. Russ) wrote:
> (2)  [Better].  Write your own printing method and specialize it as
>      desired for various types.  Of course, this means that you would
>      have to handle printing of CONS, VECTOR, etc. yourself, but that
>      does give you the most control.  And it also isolates you from
>      interference with other code.
Well yeah, I just had this idea with describe, so it had to be
describe, you know.
Of course, as the code based on mop works for any object, I don't have
to specialize (ignoring CONS, VECTOR etc) and so i followed your
suggestion and renamed the method to something different (NOT
describe). From here on the rest is much more simpler,
straightforward

thanx
olivier buechel
From: Stanisław Halik
Subject: Re: describe-object only for a list of objects
Date: 
Message-ID: <gjvrj3$19pk$1@opal.icpnet.pl>
thus spoke ···············@gmail.com:

> I have specified describe-object to some object type to describe the
> object in some html-fied manner
[...]
> i.e. if the object is in *describe-object-as-html* describe object
> with html tags, else just use normal describe.

Roll up your own html-printing generic function, defaulting on
html-escaped PRINT-OBJECT when necessary. Mixing plain text output of
default PRINT-OBJECT specializations with HTML-spitting methods doesn't
seem that robust.

-- 
You only have power over people so long as you don’t take everything
away from them. But when you’ve robbed a man of everything he’s no longer
in your power — he’s free again. -- Aleksandr Isayevich Solzhenitsyn