Re: [racket-users] Using the base language’s get-info function with make-meta-reader

2016-09-10 Thread Alex Knauth

> On Sep 8, 2016, at 4:36 PM, Alexis King  wrote:
> 
> 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.

That still shouldn't be a problem with my attempted version. If the 
`convert-lang` function has access to the old `read-syntax` and the old 
`get-info` functions (the ones that the base language `provide`s), then it can 
return a `read-syntax` function that applies the old `get-info` function to the 
proper arguments to give you what you want.

> 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  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.


Re: [racket-users] Using the base language’s get-info function with make-meta-reader

2016-09-08 Thread Alexis King
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  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.


Re: [racket-users] Using the base language’s get-info function with make-meta-reader

2016-08-24 Thread Alex Knauth

> On Aug 24, 2016, at 2:05 AM, Alexis King  wrote:
> 
> When using make-meta-reader from syntax/module-reader, is it possible
> to access the “base” language’s get-info function from within the
> read or read-syntax wrapping functions? I’d like to adjust how a
> particular meta language is read based on a property on the base
> language.

A month or so ago I started work on a version of make-meta-reader that would 
allow this, but I got caught up in the 
I-have-no-idea-what-it's-supposed-to-be-doing of it. Matthew Flatt answered the 
first question I had about what the second argument was, but then I had other 
things to do and I never finished it.

If I have more time in the next 2 weeks I could look at it again...

Alex Knauth

> Currently, my guess is the answer is a fairly flat “no”, but I
> figured I’d ask in case I was missing something.


-- 
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.


[racket-users] Using the base language’s get-info function with make-meta-reader

2016-08-24 Thread Alexis King
When using make-meta-reader from syntax/module-reader, is it possible
to access the “base” language’s get-info function from within the
read or read-syntax wrapping functions? I’d like to adjust how a
particular meta language is read based on a property on the base
language.

Currently, my guess is the answer is a fairly flat “no”, but I
figured I’d ask in case I was missing something.

-- 
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.