unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#11215: [feature request] better backtraces
@ 2012-04-10 23:11 Ian Price
  2012-07-04 19:46 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Price @ 2012-04-10 23:11 UTC (permalink / raw)
  To: 11215


This is more of a feature request/reminder, than a bug report, but we
don't have a wish list so,....


Tail calls, we all love them, but sometimes they conflict with error
handling, and is often used as the scapegoat for why $language doesn't
support them.

shizzy0 posted the following example and output to the #guile IRC channel

(define (g)
  (error "This is broken because ~a" 1))
(g)

;; $ guile -q --debug test-error.scm 
;; Backtrace:
;; In ice-9/boot-9.scm:
;;  149: 10 [catch #t #<catch-closure 101303d80> ...]
;;  157: 9 [#<procedure 10129e190 ()>]
;; In unknown file:
;;    ?: 8 [catch-closure]
;; In ice-9/boot-9.scm:
;;   63: 7 [call-with-prompt prompt0 ...]
;; In ice-9/eval.scm:
;;  407: 6 [eval # #]
;; In ice-9/boot-9.scm:
;; 2111: 5 [save-module-excursion #<procedure 1012a2100 at ice-9/boot-9.scm:3646:3 ()>]
;; 3653: 4 [#<procedure 1012a2100 at ice-9/boot-9.scm:3646:3 ()>]
;; 1380: 3 [%start-stack load-stack ...]
;; 1385: 2 [#<procedure 10133cc90 ()>]
;; In unknown file:
;;    ?: 1 [primitive-load "/Users/shane/School/uvm/CSYS-395-evolutionary-robotics/bullet-2.79/Demos/GuileDemo/test-error.scm"]
;;    ?: 0 [scm-error misc-error #f "~A ~S" ("This is broken because ~a" 1) #f]
;;
;; ERROR: In procedure scm-error:
;; ERROR: This is broken because ~a 1

One issue was that he wasn't auto compiling guile code, but there are
two tail calls here. One is the obvious one, in g. And the other, which
surprised me, was with respect to the main program itself. Thus we get
the limited backtrace in an unknown file.

It is possible to provide full backtraces, and source location for error
messages with tail calls, though it's usually more work and requires
overhead, but it's something to think about for the --debug engine at
least.

It would also be nice as a specific counterexample of an implementation
in practice for all the tail call naysayers. :)

-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#11215: [feature request] better backtraces
  2012-04-10 23:11 bug#11215: [feature request] better backtraces Ian Price
@ 2012-07-04 19:46 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2012-07-04 19:46 UTC (permalink / raw)
  To: Ian Price; +Cc: 11215

On Wed 11 Apr 2012 01:11, Ian Price <ianprice90@googlemail.com> writes:

> Tail calls, we all love them, but sometimes they conflict with error
> handling, and is often used as the scapegoat for why $language doesn't
> support them.

I agree, fwiw, and probably
http://funcall.blogspot.com/2009/05/you-knew-id-say-something-part-iv.html
is the answer.

Andy
-- 
http://wingolog.org/





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-04 19:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-10 23:11 bug#11215: [feature request] better backtraces Ian Price
2012-07-04 19:46 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).