[racket] define-generics #:defaults

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Wed Jul 10 12:03:56 EDT 2013

That's a bug. I'll push a fix shortly.

In the meantime, here's a workaround: instead of using #:defaults, you
can define for each method `m' (and for the predicate of the generic
interface), a function `m/defaults' that explicitly dispatches to the
default cases, then falls back to `m'. Then, export these functions,
renaming `m/defaults' to `m'.

Thanks for the report!

Vincent


At Wed, 10 Jul 2013 11:03:35 +0200,
Bert De Ketelaere wrote:
> 
> [1  <multipart/alternative (7bit)>]
> [1.1  <text/plain; iso-8859-1 (quoted-printable)>]
> Helo,
> 
> in the documentation it is mentioned that the syntax for define-generics #:defaults is the same as for struct #:methods:
> http://docs.racket-lang.org/reference/struct-generics.html#%28form._%28%28lib._racket%2Fgeneric..rkt%29._define-generics%29%29
> and #:methods specifies that define/generic can be used to bind the generic method:
> http://docs.racket-lang.org/reference/define-struct.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._struct%29%29
> 
> but unfortunately using define/generic in #:defaults is a syntax error.
> Is it possible to access the generic method from inside #:defaults definitions?
> 
> Groeten,
> Bert
>  		 	   		  
> [1.2  <text/html; iso-8859-1 (quoted-printable)>]
> 
> [2  <text/plain; us-ascii (7bit)>]
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.