[plt-scheme] displaying errors in custom language levels

From: Robby Findler (robby at cs.uchicago.edu)
Date: Thu Jan 26 08:37:11 EST 2006

At Thu, 26 Jan 2006 02:56:37 -0500, Dave Herman wrote:
> > I, for one, am not able to guess what's going wrong from what you write 
> > below. But if you can produce a simple tool or perhaps produce a small 
> > example just using `eval' in the graphical language, I may be able to 
> > spot what's going wrong.
> Okay, I've attached a few files that go in a collect called 
> `little-lang' -- put it in a PLTCOLLECTS-enabled directory and run 
> setup-plt. Then restart DrScheme and select the "A Little Language" 
> language.

You're not getting any source locations in the error message because
the code is not recording any source locations! 

Your code is the rough equivalent of this:

% mzscheme -e '(+ 1 (+ 2 #f))'
Welcome to MzScheme version 300.3, Copyright (c) 2004-2006 PLT Scheme Inc.
+: expects type <number> as 2nd argument, given: #f; other arguments were: 2

and you can see there's no source location there.

Forgetting about the recent changes to mzscheme to record procedure's
locations, there is no built in way to record locations of errors. You
have to implement it or use a library, like errortrace.

There are two basic techniques. Errortrace's (where information is
recorded with continuation marks on all subexpressions, and extracted
from the exception record by the error-display handler) and the one
used by syntax errors (search for exn:srcloc in Help Desk).


Posted on the users mailing list.