Alright, I’m finally taking a look at this (and looping the users
list back in). I think, unfortunately, your (Alex’s) change isn’t
quite sufficient: having access to the get-info function isn’t
enough. The read and read-syntax functions need access to the lambda
returned by the base language’s get-info procedure, not the wrapper
function that accepts an input port.

I just tried my hand at this, and I managed to get a hacky solution
working. I’ve put my version in a gist here:

https://gist.github.com/lexi-lambda/12b3c23d58937ce66fff03be2adb6e99

The above code is almost identical to make-meta-reader from
syntax/module-reader, but the read-fn function is altered to pass
both the underlying read or read-syntax function AND the result of
-get-info to the convert-read function. You can see this on line
65 of the above gist.

The interface is still pretty bad, since it requires that users of
the function accept both arguments, so I’d want to clean it up a
lot before putting it in a package somewhere. I don’t have any
immediate plans to do that yet, though, so somebody might find some
use for this code in the meantime. I’ve successfully used this code
to implement a language extension that uses the result of a base
language’s get-info function to direct how reading should work.

Alexis

> On Sep 6, 2016, at 9:19 PM, Alex Knauth <alexan...@knauth.org> wrote:
> 
> I have no idea whether this works or not; it's completely untested. I took 
> the existing implementation of make-meta-reader and tried to manipulate it 
> into something that allowed one `convert-lang` function to convert the 
> `read`, `read-syntax`, and `get-info` functions together, with each able to 
> reference the base-language's versions of the others. I might have made some 
> mistakes confusing the get-info function with the function that get-info 
> returns, things like that. I have no idea how many of those kinds of errors I 
> might have made.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to