[plt-scheme] hooking into the default read handler
On Mar 23, 2005, at 7:37 AM, Hans Oesterholt-Dijkema wrote:
> In mzscheme, is it possible to define a reader/writer for custom
> types?
>
> Suppose e.g.:
>
> (type object-identifier) would be written like: $oid:<number>.
>
> Is it possible to add a handler for this type to the default read/write
> handler functions for 'read' and 'write'?
I have checked a port wrapping system into PLaneT
http://planet.plt-scheme.org:80/207.1/newest.html#here-readers.plt1.0
You could probably turn that into a custom reader, depending on what
you mean by "custom"
(in that, the input format has to look something like a Here-Doc)
Of course, that doesn't help you read in your $oid:<number>'s. For
that, you could probably go through the code of the planet package and
figure out how to hack up a different port wrapper that does the right
thing.
The important bit is how to make read-syntax still work; that was the
hardest part of the work I did for the package, at least.
-Felix
p.s. and of course, this solution doesn't help you at all with writing
these things back out.
----
"You don't get out until I hammer it into your little heads!"
-G.C. Rota (10/24/97)