[racket-dev] no backtrace for error in macro

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Tue Nov 8 12:57:16 EST 2011

So is there a more efficient way to debug the issue than looking at the macro debugger that you know of?

Also FWIW the error I meant arose from exactly the situation below. I created a new identifier meant to be used as a literal:

  (define-syntax my-new-literal (lambda (stx) (raise-syntax-error 'literal "this is a literal meant to be used inside a macro"))

And the literal ended up in code outside the intended form that would have consumed it so the literal's syntax error was raised.

On 11/08/2011 10:51 AM, Robby Findler wrote:
> It isn't clear to me that the stacktrace is actually containing useful
> information in such cases. That is, the stack will not tell you which
> macro introduced the free identifier, only the code that finds the
> identifier (that is, the code that detects free variables).
>
> Robby
>
> On Tue, Nov 8, 2011 at 11:46 AM, Jon Rafkind <rafkind at cs.utah.edu> wrote:
>> Ok. Whats your (the) strategy for debugging these sorts of errors? Yesterday I just stared at the macro debugger output for a while until I saw where an identifier that ultimately raised a syntax error showed up.
>>
>> On 11/08/2011 10:41 AM, Robby Findler wrote:
>>> This is a change I made recently and I put a rationale and explanation
>>> in the commit message here:
>>>
>>>   http://git.racket-lang.org/plt/commit/e1ce0a0d1e6120354ace65dc3fda76d0442fb3a1
>>>
>>> Robby
>>>
>>> On Tue, Nov 8, 2011 at 11:30 AM, Jon Rafkind <rafkind at cs.utah.edu> wrote:
>>>> When this program is run in DrRacket the error is displayed in the interactions pane with a backtrace icon next to it but if you click that icon the backtrace window is blank. It would be nice to get some sort of backtrace or I suppose in the worst case no backtrace icon should appear.
>>>>
>>>> #lang racket
>>>>
>>>> (define-syntax (foo stx) (raise-syntax-error 'foo "dont use foo"))
>>>> (define-syntax (bar stx)
>>>>  #'(foo))
>>>>
>>>> (bar)
>>>>
>>>>
>>>> _________________________________________________
>>>>  For list-related administrative tasks:
>>>>  http://lists.racket-lang.org/listinfo/dev
>>>>
>>



Posted on the dev mailing list.