Thanks. I've pushed a fix.
https://github.com/racket/racket/commit/8c5c8da1a7e8c63460125d5cde3cdc5e1240a09c
Robby
On Sun, Feb 5, 2017 at 3:44 AM, Philip McGrath wrote:
> Contracts created with ->* don't seem to be enforcing their #:pre/desc
> pre-conditions.
>
> Given this program:
>>
>> #lang racket
>> (module private racket
>> (provide get-apples-allowed?
>>get-apples)
>> (define get-apples-allowed?
>> (make-parameter #f))
>> (define (get-apples)
>> 'apples))
>> (module broken racket
>> (require (submod ".." private))
>> (provide
>>(contract-out
>> [rename get-apples broken-get-apples
>> (->* ()
>> ()
>> #:pre/desc (or (get-apples-allowed?)
>> "get-apples not allowed")
>> any)])))
>> (module working racket
>> (require (submod ".." private))
>> (provide
>>(contract-out
>> [rename get-apples working-get-apples
>> (->i ()
>> ()
>> #:pre/desc () (or (get-apples-allowed?)
>>"get-apples not allowed")
>> any)])))
>> (require (submod "." working)
>> (submod "." broken))
>
>
> Evaluating (working-get-apples) produces an error as expected, but
> evaluating (broken-get-apples) produces 'apples.
>
> --
> 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.
--
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.