Re: [racket-users] losing syntax context

2017-03-08 Thread Dan Liebgold
On Wednesday, March 8, 2017 at 11:14:53 AM UTC-8, Jay McCarthy wrote:
> 
> (let ([name-i-want (lambda args body)]) name-i-want)
> 

Yup, that does it. Thanks!

> Jay

-- 
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] losing syntax context

2017-03-08 Thread Jay McCarthy
There are a few ways.

procedure-rename works at runtime

Or you can influence the inferred value name ---
http://docs.racket-lang.org/reference/syntax-model.html?q=procedure-rename#%28part._infernames%29
--- by setting the syntax property or expanding to something like

(let ([name-i-want (lambda args body)]) name-i-want)

Jay


On Wed, Mar 8, 2017 at 2:11 PM, Dan Liebgold
 wrote:
> On Wednesday, March 8, 2017 at 10:56:48 AM UTC-8, Jay McCarthy wrote:
>> You want to use syntax/loc. The error message comes from the lambda,
>> not from the keyword argument. It could be possible to change where
>>
>
> Yup, that fixes it. Thanks!   I experimented with syntax/loc in various 
> places, but didn't try that spot.
>
> Now, for a bonus, is there a way to assign a name to the lambda that the 
> error message will use?  Right now it just shows the file and line number...
>
>> --
>> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
>> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
>> -=[ Moses 1:33: And worlds without number have I created; ]=-
>
> --
> 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.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

-- 
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] losing syntax context

2017-03-08 Thread Dan Liebgold
On Wednesday, March 8, 2017 at 10:56:48 AM UTC-8, Jay McCarthy wrote:
> You want to use syntax/loc. The error message comes from the lambda,
> not from the keyword argument. It could be possible to change where
> 

Yup, that fixes it. Thanks!   I experimented with syntax/loc in various places, 
but didn't try that spot.

Now, for a bonus, is there a way to assign a name to the lambda that the error 
message will use?  Right now it just shows the file and line number...

> -- 
> -=[ Jay McCarthy   http://jeapostrophe.github.io]=-
> -=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
> -=[ Moses 1:33: And worlds without number have I created; ]=-

-- 
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] losing syntax context

2017-03-08 Thread Jay McCarthy
You want to use syntax/loc. The error message comes from the lambda,
not from the keyword argument. It could be possible to change where
lambda looks for the error srcloc, but if you don't want to do that,
you can just use syntax/loc in the right spot:

http://pasterack.org/pastes/77933

On Wed, Mar 8, 2017 at 1:28 PM, Dan Liebgold
 wrote:
> I have a syntax transformer that loses enough syntax context that it's error 
> message points to the transformer rather than the usage. Here's an example of 
> what it should do:
>
> http://pasterack.org/pastes/89138
>
> This one gives correct syntax in the error message (not in pasterack, but in 
> Dr Racket), but I have code that appears identical in all important ways that 
> only gives context inside transformer.
>
> What could cause this usage to lose context?
>
> Thanks,
> Dan
>
> --
> 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.



-- 
-=[ Jay McCarthy   http://jeapostrophe.github.io]=-
-=[ Associate ProfessorPLT @ CS @ UMass Lowell ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

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