> On Jul 13, 2016, at 7:46 PM, Robby Findler <ro...@eecs.northwestern.edu> 
> wrote:
> 
> I don't think that either of the options I suggested require you to do that.
> 
> The debugger works as a post-expansion process that rewrites the
> program. A language could use a similar approach, but work only for
> the files in that language.
> 
> Robby

Oh, yes. I could do this after expansion. But if I can define it as a macro 
that looks at the lexical context locally that would be so much better (and 
easier) than using a whole-program transformation.

Would `syntax-debug-info` help here? Would the `'bindings` option have the 
information I want?

Alex Knauth

> On Wed, Jul 13, 2016 at 6:32 PM, Alex Knauth <alexan...@knauth.org> wrote:
>> 
>>> On Jul 13, 2016, at 7:25 PM, Robby Findler <ro...@eecs.northwestern.edu> 
>>> wrote:
>>> 
>>> You could define a language. Or you could do what DrRacket's debugger is 
>>> doing?
>>> 
>>> Robby
>> 
>> That would would if I was willing to re-define every possible binding form 
>> that could ever be used. But then if I import something like `match`, or 
>> `generic-bind`, or `syntax-parse`, it won't give it the information it needs 
>> to create the repl. I would have to re-define all of those libraries as well.
>> 
>> That's why I would much rather see if I can use the lexically bound 
>> identifiers from the lexical context of the syntax object, if that's 
>> possible.
>> 
>> Alex Knauth
>> 
>>> On Wed, Jul 13, 2016 at 2:33 PM, Alex Knauth <alexan...@knauth.org> wrote:
>>>> 
>>>>> On Jul 13, 2016, at 3:28 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:
>>>>> 
>>>>> At Wed, 13 Jul 2016 14:16:11 -0400, Alex Knauth wrote:
>>>>>> 
>>>>>> Thanks. So defining it as a function won't work. But if I define it as a
>>>>>> macro, can I get more information out of it?
>>>>> 
>>>>> Instead of
>>>>> 
>>>>> (define (f x y)
>>>>> ;; x and y are local variables
>>>>> (debug-repl/stx))
>>>>> 
>>>>> you could create a `define-buggy`
>>>>> 
>>>>> (define-buggy (f x y)
>>>>> ;; x and y are local variables
>>>>> (debug-repl/stx))
>>>>> 
>>>>> where `define-buggy` expands to include references to `x` and `y`,
>>>>> perhaps in cooperation with `debug-repl/stx`:
>>>>> 
>>>>> (define-values (f)
>>>>> (lambda (x y)
>>>>>   ;; x and y are local variables
>>>>>   (debug-repl (hash 'x x 'y y))))
>>>>> 
>>>>> Of course, you can also set up a language where `define` means
>>>>> `define-buggy` or where `#%module-begin` parses its expanded body.
>>>>> The "Debug" button in DrRacket works something like that, but it's
>>>>> implemented as an external pass over the output of `expand`, instead of
>>>>> as a macro.
>>>> 
>>>> But then if there were any local variables introduced by any form that I 
>>>> didn't define as a "buggy" version, those wouldn't be included. Is there 
>>>> any way to get a macro to expand to the `(hash 'x x 'y y)` stuff?
>>>> 
>>>> It has to be in the lexical context of the syntax object somewhere, 
>>>> because the original function I made could distinguish between bound and 
>>>> unbound variables. Would there be a way to get a list of all the local 
>>>> variables in the lexical context?
>>>> 
>>>> Alex Knauth

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