Hello all- If I define a GOOPS class like so... (use-modules (oop goops)) (define-class <foo> ()) <foo> When it is printed, it has a long hex string in it $2 = #<<class> <foo> 7fa3d9a5bc80> Is there a way to change how a class prints itself so that it does not have a hex string? So that it is just #<<class> <foo>> or something similar? Thanks, Mike Gran
You can define the write and display methods for a metaclass. Also see my article on inspection and metaclasses: https://www.wedesoft.de/software/2014/03/02/oop-with-goops/ Kind regards Jan On 23 February 2022 21:43:50 GMT, Mike Gran <spk121@yahoo.com> wrote: >Hello all- > >If I define a GOOPS class like so... > > (use-modules (oop goops)) > (define-class <foo> ()) > <foo> > >When it is printed, it has a long hex string in it > > $2 = #<<class> <foo> 7fa3d9a5bc80> > >Is there a way to change how a class prints itself so that >it does not have a hex string? So that it is just > > #<<class> <foo>> > >or something similar? > >Thanks, >Mike Gran > > -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
Hi Mike,
On Wed, Feb 23, 2022 at 4:44 PM Mike Gran <spk121@yahoo.com> wrote:
>
> Hello all-
>
> If I define a GOOPS class like so...
>
> (use-modules (oop goops))
> (define-class <foo> ())
> <foo>
>
> When it is printed, it has a long hex string in it
>
> $2 = #<<class> <foo> 7fa3d9a5bc80>
>
> Is there a way to change how a class prints itself so that
> it does not have a hex string? So that it is just
>
> #<<class> <foo>>
>
> or something similar?
GOOPS turns several procedures into methods, such as 'write'. I think
I've defined special write methods in the past for this purpose. Here
is a basic and silly example:
scheme@(guile-user)> (define-class <foo> ())
scheme@(guile-user)> (make <foo>)
$33 = #<<foo> 55ddef3b0680>
scheme@(guile-user)> (define-method (write (foo <foo>) port)
(display "hello" port))
scheme@(guile-user)> (make <foo>)
$34 = hello
Hope that helps,
- Dave