I'm wondering if it's possible to have a contract for a struct that only
allows certain kinds of initializations. For example, I have this:

(provide (contract-out
          [struct Result ((name (or/c Temp? Label?)) (global? boolean?)
(value (or/c VarValue? #f)))]))

But it's too general. What I'd really like to have is a contract that
combines them like an or/c (I can see what this would cause problems, just
wondering if there's a clever way around it):
(provide (contract-out
          [or/c (struct Result ((name Temp?) (global? #f) (value (or/c
VarValue? #f))))
                (struct Result ((name Label?) (global? boolean?) (value
(or/c (VarValue #f)))))]))

In this case, if name is Temp? then global? has to be #f. If name is Label?
then global? can be #t or #f. I'd like to use struct cause it provides all
the contracts for accessors and such. Note, I can use a #:guard on the
struct, but wondered if it was possible to do something along these lines
with a contract.

Thanks!
Chris

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to