Re: [racket-users] Serializing macro transformer procedures

2017-01-20 Thread Ben Greenman
I can do this in the normal Racket repl:

(define (f x)

  (define-syntax-rule (rev-apply x g)

(g x))

  (rev-apply x add1))

(f 3)
;; ==> 4


I'd like to put a `(debug-repl)` inside the definition of `f` and call
`rev-apply` in that debug repl too.

On Fri, Jan 20, 2017 at 6:52 AM, Philip McGrath 
wrote:

> How would you intend to use the macro transformer functions in the
> debug-repl? Do you intend to call them as functions on syntax objects? I'm
> not sure I understand what you're trying to achieve.
>
> -Philip
>
> On Fri, Jan 20, 2017 at 3:40 AM, Alex Knauth  wrote:
>
>>
>> On Jan 19, 2017, at 8:44 PM, Philip McGrath 
>> wrote:
>>
>> It might help if you could explain in more detail what you're trying to
>> do: I'm not sure I understand what you mean by "bring macro transformer
>> procedures down to run-time".
>>
>>
>> My goal is to have a debug-repl that includes everything in it's scope.
>> Debug-repl can use syntax-local-value access to the macro transformers in
>> it's scope, but they are compile-time objects; if I just embed them in the
>> expanded code it won't compile.  However, I these things at run-time to
>> attach them to the namespace.
>>
>> If I could serialize the lambda in
>> (define-syntax m
>>   (lambda (stx) ))
>> I could recover it at run-time and add it to the debug-repl namespace.
>>
>> (define (f x)
>>   (define-syntax m
>> (serial-lambda (stx) ; syntax-local-lift-provide: not expanding in a
>> module run-time body
>>   (syntax-case stx () [(_ e) #'e])))
>>   (debug-repl))
>>
>> Alex Knauth
>>
>> -Philip
>>
>> On Wed, Jan 18, 2017 at 6:24 PM, Alex Knauth 
>> wrote:
>>
>>> I'm trying to use serial-lambda in macro transformer procedures so that
>>> I can serialize them and bring them down to run-time. However,
>>> serial-lambda isn't working within a define-syntax. It says:
>>>
>>> syntax-local-lift-provide: not expanding in a module run-time body
>>>
>>> This seems to be a lie; it works fine in a begin-for-syntax (as long as
>>> you don't try to deserialize). What's the real reason it doesn't work in a
>>> define-syntax? Is there another way to bring macro transformer procedures
>>> down to run-time?
>>>
>>> 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.
>

-- 
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] Serializing macro transformer procedures

2017-01-20 Thread Philip McGrath
How would you intend to use the macro transformer functions in the
debug-repl? Do you intend to call them as functions on syntax objects? I'm
not sure I understand what you're trying to achieve.

-Philip

On Fri, Jan 20, 2017 at 3:40 AM, Alex Knauth  wrote:

>
> On Jan 19, 2017, at 8:44 PM, Philip McGrath 
> wrote:
>
> It might help if you could explain in more detail what you're trying to
> do: I'm not sure I understand what you mean by "bring macro transformer
> procedures down to run-time".
>
>
> My goal is to have a debug-repl that includes everything in it's scope.
> Debug-repl can use syntax-local-value access to the macro transformers in
> it's scope, but they are compile-time objects; if I just embed them in the
> expanded code it won't compile.  However, I these things at run-time to
> attach them to the namespace.
>
> If I could serialize the lambda in
> (define-syntax m
>   (lambda (stx) ))
> I could recover it at run-time and add it to the debug-repl namespace.
>
> (define (f x)
>   (define-syntax m
> (serial-lambda (stx) ; syntax-local-lift-provide: not expanding in a
> module run-time body
>   (syntax-case stx () [(_ e) #'e])))
>   (debug-repl))
>
> Alex Knauth
>
> -Philip
>
> On Wed, Jan 18, 2017 at 6:24 PM, Alex Knauth  wrote:
>
>> I'm trying to use serial-lambda in macro transformer procedures so that I
>> can serialize them and bring them down to run-time. However, serial-lambda
>> isn't working within a define-syntax. It says:
>>
>> syntax-local-lift-provide: not expanding in a module run-time body
>>
>> This seems to be a lie; it works fine in a begin-for-syntax (as long as
>> you don't try to deserialize). What's the real reason it doesn't work in a
>> define-syntax? Is there another way to bring macro transformer procedures
>> down to run-time?
>>
>> 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.


Re: [racket-users] Serializing macro transformer procedures

2017-01-20 Thread Alex Knauth

> On Jan 19, 2017, at 8:44 PM, Philip McGrath  wrote:
> 
> It might help if you could explain in more detail what you're trying to do: 
> I'm not sure I understand what you mean by "bring macro transformer 
> procedures down to run-time".

My goal is to have a debug-repl that includes everything in it's scope. 
Debug-repl can use syntax-local-value access to the macro transformers in it's 
scope, but they are compile-time objects; if I just embed them in the expanded 
code it won't compile.  However, I these things at run-time to attach them to 
the namespace.

If I could serialize the lambda in
(define-syntax m
  (lambda (stx) ))
I could recover it at run-time and add it to the debug-repl namespace.

(define (f x)
  (define-syntax m
(serial-lambda (stx) ; syntax-local-lift-provide: not expanding in a module 
run-time body
  (syntax-case stx () [(_ e) #'e])))
  (debug-repl))

Alex Knauth

> -Philip
> 
> On Wed, Jan 18, 2017 at 6:24 PM, Alex Knauth  > wrote:
> I'm trying to use serial-lambda in macro transformer procedures so that I can 
> serialize them and bring them down to run-time. However, serial-lambda isn't 
> working within a define-syntax. It says:
> 
> syntax-local-lift-provide: not expanding in a module run-time body
> 
> This seems to be a lie; it works fine in a begin-for-syntax (as long as you 
> don't try to deserialize). What's the real reason it doesn't work in a 
> define-syntax? Is there another way to bring macro transformer procedures 
> down to run-time?
> 
> 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.


Re: [racket-users] Serializing macro transformer procedures

2017-01-19 Thread Philip McGrath
It might help if you could explain in more detail what you're trying to do:
I'm not sure I understand what you mean by "bring macro transformer
procedures down to run-time".

-Philip

On Wed, Jan 18, 2017 at 6:24 PM, Alex Knauth  wrote:

> I'm trying to use serial-lambda in macro transformer procedures so that I
> can serialize them and bring them down to run-time. However, serial-lambda
> isn't working within a define-syntax. It says:
>
> syntax-local-lift-provide: not expanding in a module run-time body
>
> This seems to be a lie; it works fine in a begin-for-syntax (as long as
> you don't try to deserialize). What's the real reason it doesn't work in a
> define-syntax? Is there another way to bring macro transformer procedures
> down to run-time?
>
> 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.
>

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