[plt-scheme] swindle and custom struct

From: YC (yinso.chen at gmail.com)
Date: Thu Sep 6 23:43:58 EDT 2007

On 9/6/07, Eli Barzilay <eli at barzilay.org> wrote:
> > The classes that you get from `struct-type->class' are intended for
> > generic function dispatching only.  Making <make> work with these will
> > require much more work.

Yeah I'm finding that out the hard way :)

As written in the message
http://list.cs.brown.edu/pipermail/plt-scheme/2007-September/020471.html, I
am able to get the initial part going by

1) modify extra.ss to export struct-type->class*
2) wrap around define-struct* and struct-type->class*

but I ran into a few issues and have some questions:

1) why does a procedurized struct returns a swindle instance if called via
<make>?  struct-type->class appear to catch whether a struct-type is
procedure and changes the super class to <procedure-class>, but why do that
when the returned instance cannot be called as a procedure?

2) Also, it appears that procedurized struct cannot be inherited in swindle
object system.  Trying to do so either with my hacks or with
struct-type->class would raise an error:

; with the sample code in
> (defstruct* <foo1> (value)
  (#:guard (lambda (value struct)
             (values value)))
  (#:procedure (lambda (x) x)))
> (defstruct* (<foo2> <foo1>) ())
. . collects\swindle\tiny-clos.ss::7069: top-sort: invalid constraints

Looking through the code it's not obvious where the constraint is created,
but I am assuming that the design is that a procedure has a constraint that
it cannot be inherited - correct?  If such struct cannot be inherited it
would seem to limit generic function applicabilities.

3) if such integration is too far-fetched right now - does swindle integrate
well with non swindlized structs?

Any pointers are appreciated. Thanks! ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070906/6643c674/attachment.html>

Posted on the users mailing list.