Working through the chapter on units in the Racket guide, it shows how to
translate the comment-specified contracts on toy-factory^ to enforced
contracts:

(define-signature contracted-toy-factory^
  ((contracted
    [build-toys (-> integer? (listof toy?))]
    [repaint    (-> toy? symbol? toy?)]
    [toy?       (-> any/c boolean?)]
    [toy-color  (-> toy? symbol?)])))


I am trying to figure out how you would create an analogous
contracted-toy-store^ from the example toy-store^:

(define-signature toy-store^
  (store-color     ; (-> symbol?)
   stock!          ; (integer? -> void?)
   get-inventory)) ; (-> (listof toy?))


The complication here is that the contract for get-inventory needs to have
a binding for toy?, which implicitly comes from the toy-factory^ signature.

Ultimately what I'm trying to do is to create mutually dependent units
along the lines of store-specific-factory@ from the linking example, but
where the factory could rely on the results of get-inventory being toys
according to its notion of toy?, as created by build-toys.

I have the sense that open or extends might be part of the answer, but, if
they are what I need to use, I haven't figured out how to use them properly
yet.

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.

Reply via email to