This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: GOOPS: New syntax for `define-method'?
Miroslav Silovic writes:
> Buh-link?!
???
> I had no idea this worked. And I was really talking about
> -application- evaluation.
>
> As in, ((lambda (x) x) 4) -> 4
In procedure applications, <operator> is always evaluated. If your
<operator> is a procedure call that returns a generic function, no
problem:
guile> (define-method test ((i <integer>)) (+ i 1))
guile> (define-method tull ((i <integer>)) (+ i 2))
guile> (define (find x) (if x test tull))
guile> ((find #t) 0)
1
guile> ((find #f) 0)
2
guile> ((find #f) 0.1)
ERROR: In procedure tull in expression ((find #f) 0.1):
ERROR: No applicable method for #<<generic> tull (1)> in call (tull 0.1)
ABORT: (goops-error)
Methods cannot be applied to arguments:
guile> ((car (generic-function-methods test)) 1)
ERROR: In expression ((car #) 1):
ERROR: Wrong type to apply: #<<method> (<integer>) f4708>
ABORT: (misc-error)
Regards,
Ole