guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I define a new method for display?


From: Tobias Brandt
Subject: How can I define a new method for display?
Date: Wed, 17 Apr 2013 22:25:08 +0200

Hi guys,

according to the documentation, when GOOPS is loaded, 'display' becomes a generic function.

To wit:

scheme@(guile-user)> (use-modules (oop goops))
scheme@(guile-user)> (class-of display)
$1 = #<<procedure-class> <primitive-generic> 2cfa3c0>

But adding a new method has no effect:

scheme@(guile-user)> (define-class <foo> ())
scheme@(guile-user)> (define-method (display (self <foo>)) (display "foo"))
scheme@(guile-user)> (display (make <foo>)) (newline)
#<<foo> 2f428f0>

Also, applying functions like 'generic-function-methods' to 'display' gives a type error:

>scheme@(guile-user)> (generic-function-methods display)
ERROR: In procedure generic-function-methods:
ERROR: In procedure generic-function-methods: Wrong type argument in position 1 (expecting generic function): #<procedure display (_ #:optional _)>


What am I doing wrong?

Cheers,
Tobias

reply via email to

[Prev in Thread] Current Thread [Next in Thread]