I’m working my way through the implementation of racket/generic, and this 
jumped out at me as a little odd. Apparently, in the #:defaults and 
#:fast-defaults clauses of define-generics, there is support for an 
undocumented #:dispatch clause. Using it looks a like this:

(define-generics fooable
  (foo fooable)
  #:defaults
  ([list? #:dispatch empty?
    (define (foo fooable)
      (displayln "the empty list was foo'd"))]))

As far I can tell, all this does is introduce an extra predicate that is 
checked in addition to the other one. As far as I can tell, this could just be 
done with (and/c list? empty?), so this feels quite redundant. More bizarre, if 
the #:dispatch clause is omitted, then it defaults to the same as the first 
predicate!

This means that the predicate is, when used as documented, always applied twice 
for no reason I can discern. Any authors of racket/generic that could provide 
some insight on what this is and why it exists?

Alexis

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to