[plt-scheme] how to disallow struct-copy on a particular structure type?

From: Richard Cobbe (cobbe at ccs.neu.edu)
Date: Fri Jul 10 18:16:05 EDT 2009

I'm writing a module that defines and exports a structure, but it does
*not* export the default `make-foo' function.  (The structure has 7 fields,
and not all combinations of values for those fields are legal, so I'm
exporting a wrapped version of the constructor that does validity checking
instead.)

Is there a way to prevent clients from using struct-copy on this particular
structure (and thus circumventing the validity checks)?  I know I could
simply not provide the main structure binding (i.e., `foo' for
`(define-struct foo (...))'), but that would also prevent clients from
using `match' on this kind of structure, which is too restrictive.

Thanks,

Richard


Posted on the users mailing list.