[CM] Backtrace in s7
k.s.matheussen at gmail.com
Sun Oct 5 12:35:27 PDT 2014
Hi Bil and the rest of you,
I've added s7 as an extension language  to the 3.0 branch 
of the Radium music editor .
Some details about it: A small web server running inside Radium
is communicating with an external python script. This python script
functions as a repl for S7 . This method works excellently, since the
repl doesn't have to be restarted if radium crashes, and you don't
have to run radium (which is quite bloated) from inside
emacs (which I'm using as lisp code editor). Right now I'm working
on rewriting all the mouse handling in s7, since the current
code (written in c) needs to be rewritten anyway, and this is simpler
to implement in scheme than in c.
S7 has so far been an excellent scheme implementation for me.
It's impressively fast (even mysteriously impressively fast, at
least for calculating the fibbonacci numbers), the api is dead simple,
and it's simple to embed into other programs. It's a quite perfect
extension language I would say.
But I wonder if it's possible to get a more detailed
backtrace if something goes wrong?
For instance, if I run the following code:
I get this response:
error message: [
;e: unbound variable
; "/home/kjetil/radium3.0/bin/scheme/mouse/bug.scm", line 2
; d: (e)
; (load "/home/kjetil/radium3.0/bin/scheme/...
Which is good, but sometimes not good enough, since I tend
to write a lot of spaghetti-like code.
Ideally, something like this would be nice:
;5. e: unbound variable, bug.scm
;4. (d), bug.scm
;3. (c), bug.scm
;2. (b), bug.scm
;1. (a), bug.scm
I've looked over the documentation, experimented with code
that catches exceptions and inspecting data that calls "owlet",
but haven't found a way to get the kind of backtrace I want.
Is it possible to get this type of backtrace at all? Or perhaps
there is a different and perhaps better way to debug an s7 program?
I can live without this kind of backtrace though, so it's not
a big problem, and certainly not a show stopper.
I also have a feature request, which might be a lot of work
to implement, but would also be very nice to have. The feature is to give
warnings for undefined variables and functions.
For instance, if you try to evaluate
(let ((hello2 9))
(+ hello2 hello3))
s7 would give a warning if hello3 isn't defined.
Guile has recently gotten this feature, and when
I developed a small software package for guile earlier this year,
it probably saved me a lot of time, since discovering undefined
variables and functions in code during runtime is harder and more
random than getting a message about it during compile time.
I think the lisp language "Shen" also has this feature, and that
in Shen you can turn off the warning by using a special macro,
I think the name might be "extern" or something like that.
(I.e. "(extern hello3)").
Thanks for reading,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cmdist