I have no plans to ever change that behavior.  I consider the default arguments 
as being inside the contract boundary for these definitions, which means they 
are unchecked.  The programmer of the function, not the client of the function, 
is responsible for these values, so he can either ignore the contract or stick 
to it as desired.

Stevie

On Oct 1, 2011, at 2:23 PM, Neil Toronto wrote:

> This seems odd, but is useful:
> 
> (define/contract (foo #:opt1 [opt1 #f] #:opt2 [opt2 #f])
>    (->* () (#:opt1 real? #:opt2 real?) real?)
>  (or opt1 opt2 30))
> 
> 
> The keyword arguments' default values aren't 'real?', but nothing complains 
> when 'foo' is applied.
> 
> It allows me to have 'foo' with an '#:opt1' keyword with contract 'real?', 
> default 30, and an '#:opt2' keyword for backward-compatibility:
> 
> (foo)                      ; => 30
> (foo #:opt1 45)            ; => 45
> (foo #:opt2 23)            ; => 23
> (foo #:opt1 45 #:opt2 23)  ; => 45
> 
> 
> Is it intentional? Will this behavior ever change?
> 
> Neil T
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users


_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to