This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: G-wrap to help with translations


> One style of using Guile which I want to support (because I'm guessing
> it could be very powerful, by analogy with Emacs and the GIMP) is the
> style where you take some application area, like GIS or audio signal
> processing or mathematics, design your data structures and implement
> your algorithms in C, and then poke them through to the Scheme level
> as new datatypes, and procedures that operate on them.

In the "audio signal processing" area, I hope to have the Snd sound editor 

ready with Guile fully incorporated next week.  It took me about twice
as long as I expected to get this to work; I'd suggest that Guile needs
better error checking -- several times I absent-mindedly did something
like gh_define("var",0).  The result is a seg fault in Guile's GC with
no obvious way to trace back to the offending line of code.  Another
was gh_scm2int(gh_lookup("mistyped-name")) -> segfault with a stack
trace that had only the Guile top-level (no indication of where the
problem was).  Snd has about 68000 lines of C, so a bug with no stack
trace is a real annoyance!  Also the docs are not very useful -- I
now just read the code, and ignore the documentation.  Also, I'd much
rather have Guile as an embedded language, and let my program be the
main program all the time.  And it isn't obvious to me how to use
Hobbit -- I'm expecting users of Snd to write their own signal processing
code, using Snd as the user-interface to manipulate it, so I expect
large amounts of float data-related arithmetic; for example, here's
one of my tests (not intended as beautiful code):

(define display-energy
 (lambda ()
  (let* ((data (window-samples))
         (len (length data)))
   (do ((i 0 (1+ i))) ((= i len))
    (vector-set! data i (* (vector-ref data i) (vector-ref data i))))
   (snd-graph data))))

(set! graph-hook "(display-energy)")

The notion being that the user wants to see the data squared as he
moves through it pushing a slider.  I was actually surprised at how
fast this is in Guile, but it's still a bit pokey with large windows.
I was hoping Hobbit would provide the speed-up.  And along the lines
of other posts, I find it a bit unfortunate that every user-interface
related variable needs two forms -- the (set! var initial-value) form
for the initialization file, and then (at run-time) a (set-var! new-value)
form so that the C code can handle the user-interface "side-effects".
It also clogs up the Snd documentation with about 200 extra functions
that the poor user has to keep track of (I'm currently exporting
about 150 variables and 300 functions).  I suppose I should just
delete the bare variables from the documentation.  Another thing
I'd like is a gh_set -- it strikes me as kludgy to have to build a string
with the desired set! expression and pass that to Guile.  But on
the whole, I'm very happy so far with the result -- you guys have
done a great job!