[plt-scheme] Re: Serializable class.ss generics

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue May 9 07:52:50 EDT 2006

At Mon, 8 May 2006 01:41:03 +0300, "Evangelos Tsagkas" wrote:
> is there a way I can serialize the result of (make-generic %-or-<%> symbol) ?

Not currently. I've been thinking about this (it's taking me a while to
page in), and I see no reason that a generic for a serializable class
shouldn't be serializable. I just have to change the implementation of
generics.

But then there's the issue of interfaces, as you noticed:

At Tue, 9 May 2006 01:48:24 +0300, "Evangelos Tsagkas" wrote:
> However, since I cannot create
> serializable interfaces (or can I?) one of the arguments will be the
> *name* of the interface to pass to the generic's constructor. How can
> I then retrieve the run-time binding of that interface name from the
> namespace?

One possible solution is to introduce `define-serializable-interface'
to go with `define-serializable-class'; that should work in general.
Another possible solution is to add `serializable-generic', which could
grab the binding at generic-construction time (assuming that the
binding is public).

At Tue, 9 May 2006 11:46:11 +0300, "Evangelos Tsagkas" wrote:
> > ... How can
> > I then retrieve the run-time binding of that interface name from the
> > namespace?
> >
> > [...]
> 
> (namespace-variable-value ...) is the ?exp? I was after.

This is ok as long as your program resides at the top level. If your
code is in modules, though, things like `define-serializable-class' or
`serializable-generic' will be needed.

I will work on the changes, but it will probably take some time. I've
glad you found a solution in the meantime.

Matthew



Posted on the users mailing list.