On 20/03/18 16:25, Daniel Feltey wrote: > The same behavior occurs with vectors, the program > > (define v (vector 1 2)) > (define/contract vc (vectorof integer?) (vector 1 2)) > (place-message-allowed? v) > (place-message-allowed? vc) > > Produces: > > #t > #f > > I think the issue here is that both contracted vectors and structs are > wrapped in chaperones in order to enforce the contract, but that the > place machinery doesn't know what to do with chaperoned values so it > just prohibits them from being used as place messages. > > I am a little surprised that the contracted vector can't be converted to > an immutable-vector like other mutable vectors for use as a place > message though. >
Thanks for pointing that out. I hadn't noticed that. It certainly sounds like an issue to me. > > On Tue, Mar 20, 2018 at 8:03 AM, 'Paulo Matos' via Racket Users > <racket-users@googlegroups.com <mailto:racket-users@googlegroups.com>> > wrote: > > Hello, > > In a similar comment to my previous thread, I am yet again surprised at > this: > > a.rkt: > > #lang racket > > (provide (struct-out foo)) > > (struct foo (a b) > #:prefab) > > b.rkt: > > #lang racket > > (require "a.rkt") > > (place-message-allowed? (foo 1 2)) > > This works! However, try to provide in a.rkt foo like this: > (provide (contract-out (struct foo ((a integer?) > (b integer?))))) > > Suddenly you get: > #f > > Here's the even more confusing part: > (define-values (pch1 pch2) (place-channel)) > (place-channel-put pch1 (foo 1 2)) > > This will result in: > place-channel-put: value not allowed in a message > value: '#s(foo 1 2) > message: '#s(foo 1 2) > > > This will drive you mad because if you copy the message textual > representation: > (place-channel-put pch1 '#s(foo 1 2)) > > then it works. > > What's the reason for this discrepancy? There's no mentioning of > #:prefab in contract-out documentation. > > Regards, > > -- > Paulo Matos > > -- > 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 > <mailto:racket-users%2bunsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <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 > <mailto:racket-users+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout. -- Paulo Matos -- 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.