[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [EXT] GOOPS class printing
From: |
Thompson, David |
Subject: |
Re: [EXT] GOOPS class printing |
Date: |
Wed, 23 Feb 2022 16:55:00 -0500 |
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