Re: [racket-users] syntax-original? always returns #f within syntax transformers?

2015-11-12 Thread Thomas Dickerson
On Thursday, November 12, 2015 at 12:26:23 PM UTC-5, Matthew Flatt wrote: 
> The macro stepper shows a form after expansion, while Alexis's example
> was looking at it during expansion (i.e., in the dynamic extent of a
> syntax transformer). Those different times have different syntax
> objects --- although one is derived from the other --- and they have
> different properties. In particular, the syntax object during the
> transformer call has an extra scope that will be canceled when it is
> returned back from the transformer.
> 
> Inspecting syntax objects during a transformer call would be useful,
> but the current macro stepper doesn't do that.

In my case, I was using emit-local-step, and was under the impression that 
emit-local-step allowed the inspection of syntax objects as they might appear 
to the transformer, as unlike emit-remark it makes no note about marks.

-- 
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] syntax-original? always returns #f within syntax transformers?

2015-11-12 Thread Matthew Flatt
At Wed, 11 Nov 2015 10:00:15 -0800 (PST), Thomas Dickerson wrote:
> On Tuesday, October 27, 2015 at 7:24:55 AM UTC-4, Matthew Flatt wrote:
> > This role of marks has been taken over by macro-introduction scopes, so
> > that's still the explanation. A macro-introduction scope is added to
> > the right places by first adding it everywhere to the argument to a
> > macro transformer, then flipping it everywhere in the transformer's
> > result.
> > 
> > (The documentation of `syntax-original?` includes an attempt to specify
> > that, but none of the documentation is clear enough yet about scopes.)
> 
> I'm looking at this documentation now ( 
> http://docs.racket-lang.org/reference/stxops.html#%28def._%28%28quote._~23~25ke
> rnel%29._syntax-original~3f%29%29 ) and see nothing of the sort. Can you 
> specify where this is hypothetically being communicated?

FWIW, I had in mind the "if stx’s lexical information does not indicate
that the object was introduced by a syntax transformer (see Syntax
Objects)" and the slightly more explicit variant in the development
docs.

But I completely agree that you can't get the relevant information from
that sentence or the links that it refers to, and the docs still need a
lot of work in this area.

> That the macro stepper simultaneously allows you to click on the syntax in a 
> remark or local step and see #t for original?, while simultaneously returning 
> false for syntax-original? is incredibly user hostile.

The macro stepper shows a form after expansion, while Alexis's example
was looking at it during expansion (i.e., in the dynamic extent of a
syntax transformer). Those different times have different syntax
objects --- although one is derived from the other --- and they have
different properties. In particular, the syntax object during the
transformer call has an extra scope that will be canceled when it is
returned back from the transformer.

Inspecting syntax objects during a transformer call would be useful,
but the current macro stepper doesn't do that.

-- 
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] syntax-original? always returns #f within syntax transformers?

2015-11-11 Thread Robby Findler
Hi Thomas: thank you for participating in the Racket community and
submitting reports that help us improve the docs and the
implementation.

Love & Peace,
Robby


On Wed, Nov 11, 2015 at 12:00 PM, Thomas Dickerson
 wrote:
> On Tuesday, October 27, 2015 at 7:24:55 AM UTC-4, Matthew Flatt wrote:
>> This role of marks has been taken over by macro-introduction scopes, so
>> that's still the explanation. A macro-introduction scope is added to
>> the right places by first adding it everywhere to the argument to a
>> macro transformer, then flipping it everywhere in the transformer's
>> result.
>>
>> (The documentation of `syntax-original?` includes an attempt to specify
>> that, but none of the documentation is clear enough yet about scopes.)
>
> I'm looking at this documentation now ( 
> http://docs.racket-lang.org/reference/stxops.html#%28def._%28%28quote._~23~25kernel%29._syntax-original~3f%29%29
>  ) and see nothing of the sort. Can you specify where this is hypothetically 
> being communicated?
>
>
>
> That the macro stepper simultaneously allows you to click on the syntax in a 
> remark or local step and see #t for original?, while simultaneously returning 
> false for syntax-original? is incredibly user hostile.

-- 
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] syntax-original? always returns #f within syntax transformers?

2015-11-11 Thread Thomas Dickerson
On Tuesday, October 27, 2015 at 7:24:55 AM UTC-4, Matthew Flatt wrote:
> This role of marks has been taken over by macro-introduction scopes, so
> that's still the explanation. A macro-introduction scope is added to
> the right places by first adding it everywhere to the argument to a
> macro transformer, then flipping it everywhere in the transformer's
> result.
> 
> (The documentation of `syntax-original?` includes an attempt to specify
> that, but none of the documentation is clear enough yet about scopes.)

I'm looking at this documentation now ( 
http://docs.racket-lang.org/reference/stxops.html#%28def._%28%28quote._~23~25kernel%29._syntax-original~3f%29%29
 ) and see nothing of the sort. Can you specify where this is hypothetically 
being communicated?



That the macro stepper simultaneously allows you to click on the syntax in a 
remark or local step and see #t for original?, while simultaneously returning 
false for syntax-original? is incredibly user hostile.

-- 
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] syntax-original? always returns #f within syntax transformers?

2015-10-27 Thread Matthew Flatt
This role of marks has been taken over by macro-introduction scopes, so
that's still the explanation. A macro-introduction scope is added to
the right places by first adding it everywhere to the argument to a
macro transformer, then flipping it everywhere in the transformer's
result.

(The documentation of `syntax-original?` includes an attempt to specify
that, but none of the documentation is clear enough yet about scopes.)

At Tue, 27 Oct 2015 04:31:57 -0500, Robby Findler wrote:
> syntax-original? is querying a private property and that property
> isn't set on the syntax object argument given to the transformer. (I
> would have said because of the extra mark that's put on the argument,
> but that's not happening now, but we get the same behavior anyway.)
> 
> If you call syntax-local-introduce, you'll see the expected printouts:
> 
> #lang racket
> (define-syntax (print-original stx)
>   (syntax-case stx ()
> [(_ datum)
>  (begin
>(displayln (syntax-original? (syntax-local-introduce #'datum)))
>#'#'datum)]))
> 
> (syntax-original? (print-original 'foo))
> 
> Robby
> 
> 
> On Tue, Oct 27, 2015 at 1:56 AM, Alexis King  wrote:
> > I wrote a simple program that determines whether a piece of syntax is 
> original in two different ways:
> >
> > (define-syntax (print-original stx)
> >   (syntax-case stx ()
> > [(_ datum)
> >  (begin
> >(displayln (syntax-original? #'datum))
> >#'#'datum)]))
> >
> > (syntax-original? (print-original 'foo))
> >
> > Running it prints #f, then #t. This seems to imply that #'datum is not 
> considered syntax-original? within the syntax transformer, but in the 
> expansion, it is. Stepping though the expression within the macro stepper, 
> the 
> identifier always seems to be considered original, so I would expect both 
> cases to be #t.
> >
> > Why is the result of syntax-original? different within the two contexts? If 
> this is the intended behavior, could it maybe be explained in the 
> documentation?
> >
> > Thanks,
> > Alexis
> >
> > --
> > 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.

-- 
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] syntax-original? always returns #f within syntax transformers?

2015-10-27 Thread Robby Findler
syntax-original? is querying a private property and that property
isn't set on the syntax object argument given to the transformer. (I
would have said because of the extra mark that's put on the argument,
but that's not happening now, but we get the same behavior anyway.)

If you call syntax-local-introduce, you'll see the expected printouts:

#lang racket
(define-syntax (print-original stx)
  (syntax-case stx ()
[(_ datum)
 (begin
   (displayln (syntax-original? (syntax-local-introduce #'datum)))
   #'#'datum)]))

(syntax-original? (print-original 'foo))

Robby


On Tue, Oct 27, 2015 at 1:56 AM, Alexis King  wrote:
> I wrote a simple program that determines whether a piece of syntax is 
> original in two different ways:
>
> (define-syntax (print-original stx)
>   (syntax-case stx ()
> [(_ datum)
>  (begin
>(displayln (syntax-original? #'datum))
>#'#'datum)]))
>
> (syntax-original? (print-original 'foo))
>
> Running it prints #f, then #t. This seems to imply that #'datum is not 
> considered syntax-original? within the syntax transformer, but in the 
> expansion, it is. Stepping though the expression within the macro stepper, 
> the identifier always seems to be considered original, so I would expect both 
> cases to be #t.
>
> Why is the result of syntax-original? different within the two contexts? If 
> this is the intended behavior, could it maybe be explained in the 
> documentation?
>
> Thanks,
> Alexis
>
> --
> 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.


[racket-users] syntax-original? always returns #f within syntax transformers?

2015-10-26 Thread Alexis King
I wrote a simple program that determines whether a piece of syntax is original 
in two different ways:

(define-syntax (print-original stx)
  (syntax-case stx ()
[(_ datum)
 (begin
   (displayln (syntax-original? #'datum))
   #'#'datum)]))

(syntax-original? (print-original 'foo))

Running it prints #f, then #t. This seems to imply that #'datum is not 
considered syntax-original? within the syntax transformer, but in the 
expansion, it is. Stepping though the expression within the macro stepper, the 
identifier always seems to be considered original, so I would expect both cases 
to be #t.

Why is the result of syntax-original? different within the two contexts? If 
this is the intended behavior, could it maybe be explained in the documentation?

Thanks,
Alexis

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