[plt-scheme] Re: Serializable class.ss generics
On 5/9/06, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 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).
I am thinking of using a stream of generics as a cheap server state
replication mechanism. I'm not sure how well the generic-construction
time binding would play out with %-or<%> upgrades, though I suppose
this is a far-fetched requirement.
> 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.
Yes, I figured so. I guess I can go on until I hit the wall.
> I will work on the changes, but it will probably take some time. I've
> glad you found a solution in the meantime.
Sure, thank you.
> Matthew
Evangelos
--
if feeling is first who pays any attention to the syntax of things
will never wholly kiss you
-- ee cummings