Kevin,
This is what `define/generic` is for. In your example:
On Tue, Mar 3, 2020 at 11:08 AM Kevin Forchione <
lys...@gmail.com> wrote:
>
> (struct A (this other) #:transparent
> #:methods gen:foo
> [(define (do-foo foo)
> (printf "other=~a ~a"
> (A-this foo)
> (do-foo (A-other foo))))])
The call to `(doo-foo (A-other foo))` is simply a recursive call to
the function that you're in the middle of defining. In order to call
the generic method and have it dispatched appropriately, you need to
use `define/generic`:
(struct A (this other) #:transparent
#:methods gen:foo
[(define/generic generic-foo do-foo)
(define (do-foo foo)
(printf "other=~a ~a"
(A-this foo)
(generic-foo (A-other foo))))])
- Jon