Re: [racket-users] Re: Using errortrace with repl-driven-development?

2019-07-24 Thread Anthony Quizon
Thanks, but actually I think my problem was that I wasn't invoking the 
function in the repl itself.

;; myfile.rkt
...

(f 123) ;; top-level invocation doesnt produce proper stacktraces in repl


but when I typed it in the repl it was ok
> ,en "myfile.rkt"
"myfile.rkt"> (f 456) 
; ...stacktrace...




On Thursday, July 25, 2019 at 3:38:35 AM UTC+10, Shu-Hung You wrote:
>
> errortrace with ,en should work as normal, as long as you ensure that 
> there are no pre-compiled bytecode files (compiled/*.zo): 
>
> $ ls 
> myfile.rkt 
> $ racket -l errortrace -i 
> Welcome to Racket v7.2. 
> > ,en "myfile.rkt" 
> "myfile.rkt"> (f 123) 
> ; g: 123 [,bt for context] 
> "myfile.rkt"> ,bt 
> ; g: 123 
> ;   errortrace...: 
> ;/tmp/ram2/debug/myfile.rkt:6:2: (error (quote g) "~a" n) 
> ;/tmp/ram2/debug/myfile.rkt:3:2: (+ (g x) (g (+ 2 x))) 
> .. 
>
> If myfile.rkt is precompiled then errortrace wouldn't have the chance 
> to instrument it with backtrace information: 
>
> $ raco make myfile.rkt && ls * 
> myfile.rkt 
>
> compiled: 
> myfile_rkt.dep  myfile_rkt.zo 
> $ racket -l errortrace -i 
> Welcome to Racket v7.2. 
> > ,en "myfile.rkt" 
> "myfile.rkt"> (f 456) 
> ; g: 456 [,bt for context] 
> "myfile.rkt"> ,bt 
> ; g: 456 
> ;   errortrace...: 
> ;readline-input:2:0: (f 456) 
> .. 
>
> On Wed, Jul 24, 2019 at 5:36 AM Anthony Quizon  > wrote: 
> > 
> > 
> > Thanks! This one was what is needed. 
> > 
> > racket -l errortrace -l racket -i 
> > 
> > Actually, I tried this on my own before but I kept on getting "(no 
> backtrace)" when I would run my file. 
> > Turns out, you can only get the stacktrace if you run the code via the 
> repl input rather than running code within the file (ie. using ",en") 
> > 
> > On Wednesday, July 24, 2019 at 12:43:27 PM UTC+10, Alex Harsanyi wrote: 
> >> 
> >> If you are using DrRacket, you can go to the "Language/Choose 
> Language..." menu, click on "Show Details", than make sure the "Preserve 
> Stack Trace" checkbox is ticked. 
> >> 
> >> If you are using racket-mode in Emacs, you can evaluate the current 
> buffer using "C-u F5" which will do the same thing. 
> >> 
> >> If you use racket from the command line, I think you can run it as: 
> >> 
> >> racket -l errortrace -l racket -i 
> >> 
> >> Hope this helps, 
> >> Alex. 
> >> 
> >> On Wednesday, July 24, 2019 at 9:45:47 AM UTC+8, Anthony Quizon wrote: 
> >>> 
> >>> I've been trying to find a way to get better error messages in the 
> racket repl via the command line. 
> >>> Specifically, better stack traces. At the moment, if you load a file 
> in the repl via ',enter' it doesn't give you any information about the line 
> number for errors. 
> >>> 
> >>> I've looked around in the users group but could only find: 
> >>> racket -l errortrace -t .rkt 
> >>> 
> >>> This is pretty much what I'm looking for except that it only lets me 
> use this once and non-interactively. 
> >>> 
> >>> Is there an option in the (x)repl that lets me use errortrace 
> interactively for each input? 
> > 
> > -- 
> > 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...@googlegroups.com . 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/650ddb71-44ca-4758-bd08-a2b606a2f5b0%40googlegroups.com.
>  
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/01994cc4-ff73-4407-a8d6-847cf2469655%40googlegroups.com.


Re: [racket-users] Re: Using errortrace with repl-driven-development?

2019-07-24 Thread Shu-Hung You
errortrace with ,en should work as normal, as long as you ensure that
there are no pre-compiled bytecode files (compiled/*.zo):

$ ls
myfile.rkt
$ racket -l errortrace -i
Welcome to Racket v7.2.
> ,en "myfile.rkt"
"myfile.rkt"> (f 123)
; g: 123 [,bt for context]
"myfile.rkt"> ,bt
; g: 123
;   errortrace...:
;/tmp/ram2/debug/myfile.rkt:6:2: (error (quote g) "~a" n)
;/tmp/ram2/debug/myfile.rkt:3:2: (+ (g x) (g (+ 2 x)))
..

If myfile.rkt is precompiled then errortrace wouldn't have the chance
to instrument it with backtrace information:

$ raco make myfile.rkt && ls *
myfile.rkt

compiled:
myfile_rkt.dep  myfile_rkt.zo
$ racket -l errortrace -i
Welcome to Racket v7.2.
> ,en "myfile.rkt"
"myfile.rkt"> (f 456)
; g: 456 [,bt for context]
"myfile.rkt"> ,bt
; g: 456
;   errortrace...:
;readline-input:2:0: (f 456)
..

On Wed, Jul 24, 2019 at 5:36 AM Anthony Quizon  wrote:
>
>
> Thanks! This one was what is needed.
>
> racket -l errortrace -l racket -i
>
> Actually, I tried this on my own before but I kept on getting "(no 
> backtrace)" when I would run my file.
> Turns out, you can only get the stacktrace if you run the code via the repl 
> input rather than running code within the file (ie. using ",en")
>
> On Wednesday, July 24, 2019 at 12:43:27 PM UTC+10, Alex Harsanyi wrote:
>>
>> If you are using DrRacket, you can go to the "Language/Choose Language..." 
>> menu, click on "Show Details", than make sure the "Preserve Stack Trace" 
>> checkbox is ticked.
>>
>> If you are using racket-mode in Emacs, you can evaluate the current buffer 
>> using "C-u F5" which will do the same thing.
>>
>> If you use racket from the command line, I think you can run it as:
>>
>> racket -l errortrace -l racket -i
>>
>> Hope this helps,
>> Alex.
>>
>> On Wednesday, July 24, 2019 at 9:45:47 AM UTC+8, Anthony Quizon wrote:
>>>
>>> I've been trying to find a way to get better error messages in the racket 
>>> repl via the command line.
>>> Specifically, better stack traces. At the moment, if you load a file in the 
>>> repl via ',enter' it doesn't give you any information about the line number 
>>> for errors.
>>>
>>> I've looked around in the users group but could only find:
>>> racket -l errortrace -t .rkt
>>>
>>> This is pretty much what I'm looking for except that it only lets me use 
>>> this once and non-interactively.
>>>
>>> Is there an option in the (x)repl that lets me use errortrace interactively 
>>> for each input?
>
> --
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/650ddb71-44ca-4758-bd08-a2b606a2f5b0%40googlegroups.com.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAMTzy%2BZ5R68c85JjfX08MxnO%3D%2ByJ%2BFRgBFKrO9eHu8OKpVpVNg%40mail.gmail.com.


[racket-users] Re: Using errortrace with repl-driven-development?

2019-07-24 Thread Anthony Quizon

Thanks! This one was what is needed.

racket -l errortrace -l racket -i

Actually, I tried this on my own before but I kept on getting "(no 
backtrace)" when I would run my file.
Turns out, you can only get the stacktrace if you run the code via the repl 
input rather than running code within the file (ie. using ",en")

On Wednesday, July 24, 2019 at 12:43:27 PM UTC+10, Alex Harsanyi wrote:
>
> If you are using DrRacket, you can go to the "Language/Choose Language..." 
> menu, click on "Show Details", than make sure the "Preserve Stack Trace" 
> checkbox is ticked.
>
> If you are using racket-mode in Emacs, you can evaluate the current buffer 
> using "C-u F5" which will do the same thing.
>
> If you use racket from the command line, I think you can run it as:
>
> racket -l errortrace -l racket -i
>
> Hope this helps,
> Alex.
>
> On Wednesday, July 24, 2019 at 9:45:47 AM UTC+8, Anthony Quizon wrote:
>>
>> I've been trying to find a way to get better error messages in the racket 
>> repl via the command line.
>> Specifically, better stack traces. At the moment, if you load a file in 
>> the repl via ',enter' it doesn't give you any information about the line 
>> number for errors.
>>
>> I've looked around in the users group but could only find:
>> racket -l errortrace -t .rkt
>>
>> This is pretty much what I'm looking for except that it only lets me use 
>> this once and non-interactively. 
>>
>> Is there an option in the (x)repl that lets me use errortrace 
>> interactively for each input?
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/650ddb71-44ca-4758-bd08-a2b606a2f5b0%40googlegroups.com.


Re: [racket-users] Re: Using errortrace with repl-driven-development?

2019-07-23 Thread Robby Findler
In DrRacket, the "preserve stack trace" button actually corresponds to a
mode in the compiler that disables some optimizations [*]. The radio
buttons at the top (specifically the debugging one) control errortrace.

Robby

[*]
https://docs.racket-lang.org/reference/eval.html?q=Compile#%28def._%28%28quote._~23~25kernel%29._compile-context-preservation-enabled%29%29


On Wed, Jul 24, 2019 at 10:43 AM Alex Harsanyi 
wrote:

> If you are using DrRacket, you can go to the "Language/Choose Language..."
> menu, click on "Show Details", than make sure the "Preserve Stack Trace"
> checkbox is ticked.
>
> If you are using racket-mode in Emacs, you can evaluate the current buffer
> using "C-u F5" which will do the same thing.
>
> If you use racket from the command line, I think you can run it as:
>
> racket -l errortrace -l racket -i
>
> Hope this helps,
> Alex.
>
> On Wednesday, July 24, 2019 at 9:45:47 AM UTC+8, Anthony Quizon wrote:
>>
>> I've been trying to find a way to get better error messages in the racket
>> repl via the command line.
>> Specifically, better stack traces. At the moment, if you load a file in
>> the repl via ',enter' it doesn't give you any information about the line
>> number for errors.
>>
>> I've looked around in the users group but could only find:
>> racket -l errortrace -t .rkt
>>
>> This is pretty much what I'm looking for except that it only lets me use
>> this once and non-interactively.
>>
>> Is there an option in the (x)repl that lets me use errortrace
>> interactively for each input?
>>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/4cd2db48-0520-4d4b-b144-83b1e7badc1c%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAL3TdONYvPQ1qEOZ%3DK954wm1nAPGti1Fy8A53m1LmVE9B2o1Xg%40mail.gmail.com.


[racket-users] Re: Using errortrace with repl-driven-development?

2019-07-23 Thread Alex Harsanyi
If you are using DrRacket, you can go to the "Language/Choose Language..." 
menu, click on "Show Details", than make sure the "Preserve Stack Trace" 
checkbox is ticked.

If you are using racket-mode in Emacs, you can evaluate the current buffer 
using "C-u F5" which will do the same thing.

If you use racket from the command line, I think you can run it as:

racket -l errortrace -l racket -i

Hope this helps,
Alex.

On Wednesday, July 24, 2019 at 9:45:47 AM UTC+8, Anthony Quizon wrote:
>
> I've been trying to find a way to get better error messages in the racket 
> repl via the command line.
> Specifically, better stack traces. At the moment, if you load a file in 
> the repl via ',enter' it doesn't give you any information about the line 
> number for errors.
>
> I've looked around in the users group but could only find:
> racket -l errortrace -t .rkt
>
> This is pretty much what I'm looking for except that it only lets me use 
> this once and non-interactively. 
>
> Is there an option in the (x)repl that lets me use errortrace 
> interactively for each input?
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/4cd2db48-0520-4d4b-b144-83b1e7badc1c%40googlegroups.com.


[racket-users] Re: Using errortrace with repl-driven-development?

2019-07-23 Thread Anthony Quizon
Would using 'racket/trace' be a valid way to do this?

(require racket/trace)

(define (foo) ...)

(trace foo)

;; in repl (foo) then ,bt


Would it be correct to say that the error traces functionality has been 
delegated to libraries in order to make things more flexible? (Rather than 
baked into the repl)




On Wednesday, July 24, 2019 at 11:45:47 AM UTC+10, Anthony Quizon wrote:
>
> I've been trying to find a way to get better error messages in the racket 
> repl via the command line.
> Specifically, better stack traces. At the moment, if you load a file in 
> the repl via ',enter' it doesn't give you any information about the line 
> number for errors.
>
> I've looked around in the users group but could only find:
> racket -l errortrace -t .rkt
>
> This is pretty much what I'm looking for except that it only lets me use 
> this once and non-interactively. 
>
> Is there an option in the (x)repl that lets me use errortrace 
> interactively for each input?
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/9c6e6883-f83d-4b6f-88d1-116af75af2be%40googlegroups.com.