Hi, I'd like to make a generic interface as such:
#lang racket
(require racket/generic)
(define-generics interfaceable
(a interfaceable)
(b interfaceable)
#:defaults ([dummy-struct?
(define (b itfc) "I'm a default generic!")]))
(struct dummy-struct ()
#:methods gen:interfaceable
[(define (a self) "I apply to my own type!")])
I'd like to dispatch the defaults according to struct type, but this results in:
; dummy-struct?: undefined;
; cannot reference an identifier before its definition
; in module: "/home/raoul/Desktop/sqldf/scratch.rkt"
Is there a way around that with generics? Thanks!