[plt-scheme] getting the constructor from a struct-type

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Fri Feb 17 08:53:39 EST 2006

On Thu, 2006-02-16 at 20:48 -0700, Matthew Flatt wrote:
> At Thu, 16 Feb 2006 22:41:27 -0500, Sam Tobin-Hochstadt wrote:
> > I'm curious about two things:  first, might it be reasonable to extend
> > the struct-type to contain the predicate and constructor, as it
> > currently does for the accesssor etc? 
> 
> Code that already uses `struct-type-info' would break. And that code
> (and yours) would break every time we want to add something new. For
> that reason, I think it makes more sense to add functions.

I wasn't suggesting that struct-type-info produce more values, since
that has the obvious drawbacks you point out.  I was thinking that
struct-types could have the pointer to the constructor/predicate, so
that they could be gotten w/ an accessor, rather than making new ones
each time.

> 
> > Second, did the code I wrote,
> > which calls, either scheme_make_struct_instance or
> > scheme_make_struct_values, properly respect inspectors?  Can you get
> > around inspectors w/ the ffi?
> 
> As far as I can tell, it ignores inspectors.

What's the right way to check this from C/FFI code?

Thanks,

sam th



Posted on the users mailing list.