This example and variants exposed multiple problems with the
implementation of chaperones, and I've pushed repairs.

At Wed, 29 Mar 2017 09:12:25 -0600, Matthew Flatt wrote:
> It's also not really contracts, but chaperones:
> 
>  #lang racket/base
> 
>  (define kwstruct-add1
>    (let ()
>      (struct the-struct ()
>        #:property prop:procedure
>        (make-keyword-procedure (λ (kws kw-values _ i) "broken")))
>      (the-struct)))
> 
>  ((chaperone-procedure kwstruct-add1 (make-keyword-procedure
>                                       (lambda (kws values arg)
>                                         (error "no"))))
>   "bad arg")
> 
> Thanks for the example, and I'll continue investigating.
> 
> At Wed, 29 Mar 2017 10:52:05 -0400, Jay McCarthy wrote:
> > This is actually a problem in racket/contract with applicable structs
> > where prop:procedure is a keyword procedure. This file shows the
> > development --- http://pasterack.org/pastes/361 --- and the simple
> > thing that breaks is:
> > 
> > #lang racket
> > (define kwstruct-add1
> >   (let ()
> >     (struct the-struct ()
> >       #:property prop:procedure
> >       (make-keyword-procedure (λ (kws kw-values _ i) "broken")))
> >     (the-struct)))
> > ((contract (-> number? number?) kwstruct-add1 'pos 'neg) "bad arg")
> > 
> > 
> > 
> > On Mon, Mar 27, 2017 at 4:03 PM, Philip McGrath
> > <phi...@philipmcgrath.com> wrote:
> > > I've been playing around with trying to attach contracts to serializable
> > > procedures created with serial-lambda. What I've been trying to do hasn't
> > > been working, and I've also come across some surprising behavior. For
> > > example, this program:
> > >>
> > >> #lang racket
> > >> (require web-server/lang/serial-lambda
> > >>          racket/serialize
> > >>          )
> > >> (define/contract serial-add1
> > >>   (-> number? number?)
> > >>   (serial-lambda (i)
> > >>     "broken"))
> > >> (serial-add1 "bad arg")
> > >
> > > prints "broken", rather than raising an error for either the domain part 
> > > or
> > > the range part of the contract (neither of which pass).
> > >
> > > I was expecting to potentially run into trouble with things like
> > > deserialization, but I'm not at all sure why the contract in this simple
> > > example isn't enforced.
> > >
> > > Thanks,
> > > Philip
> > >
> > > --
> > > 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.
> > 
> > 
> > 
> > -- 
> > -=[     Jay McCarthy               http://jeapostrophe.github.io    ]=-
> > -=[ Associate Professor        PLT @ CS @ UMass Lowell     ]=-
> > -=[ Moses 1:33: And worlds without number have I created; ]=-
> > 
> > -- 
> > 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.

-- 
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