> 
> The calls that are missing appear to tail calls, and Racket performs
> tail-call optimization, so I imagine those missing functions are not
> really "on the stack" at the time of the error.
> 
> I don't know that there is a way around this except to deliberately
> subvert the tail-call optimization.
> 
> Otherwise, contracts would presumably help for this particular type of
> error.
> 
> Hopefully someone can correct me if I'm off the mark, or maybe provide
> more detail if I happen to be right.
> 
> David

David, you are right! See below, where I added additional calls after the tail 
calls, and routines appear in the function back trace.

So how do we turn optimization off so we can get an accurate trace?

The code-test-debug cycle is taking too long with Racket because of these 
poorly located error messages and the weak debug environment.  Making macros 
longer doesn't releieve Racket from having to provide these things.

;; bt2-ex-fun3.rkt:
;;
  #lang racket

  (define (h x y) (+ x y))

  (define (hh x y) (h x y))

  (define (f x y)
    (gg x y)
    (h 0 1)
    )

  (define (gg x y) 
    (define z 7)
    (set! z (h 5 0))
    (g (- x z) y)
    (h (+ x z) 7)
    (hh 2 0)
    )

  (define zz 5)

  (define (g x y)
    (hh (+ x (h zz 0)) y)
    )

  (f 3 5)
  (f 3 'a)

#|

ยง> racket -l errortrace -t bt2-ex-fun3.rkt
1
+: contract violation
  expected: number?
  given: 'a
  argument position: 2nd
  other arguments...:
   3
  errortrace...:
   /home/deep/3_doc/racket_err_mess/bt2-ex-fun3.rkt:6:18: (+ x y)
   /home/deep/3_doc/racket_err_mess/bt2-ex-fun3.rkt:15:2: (define (gg x y) 
(define z 7) (set! z (h 5 0)) (g (- x z) y) (h (+ x ....) 7) (hh 2 0))
   /home/deep/3_doc/racket_err_mess/bt2-ex-fun3.rkt:30:2: (f 3 (quote a))
   /home/deep/3_doc/racket_err_mess/bt2-ex-fun3.rkt:30:2: (f 3 (quote a))
  context...:
   /home/deep/3_doc/racket_err_mess/bt2-ex-fun3.rkt:6:2: h
   /home/deep/3_doc/racket_err_mess/bt2-ex-fun3.rkt:15:2: gg
   /home/deep/3_doc/racket_err_mess/bt2-ex-fun3.rkt:10:2: f
   /home/deep/3_doc/racket_err_mess/bt2-ex-fun3.rkt: [running body]

|#

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

Reply via email to