[gambit-list] Improving error reporting

Francois Magnan magnan at categoricaldesign.com
Wed Feb 4 08:43:44 EST 2015


Hi Blake,

1) Not really, appart from this mailing list from which we could extract some wiki entries. If you can you are welcome to contribute.
2) Univ-lib is the implementation of scheme that can compile to various architectures (targets), so you will need it to do any serious stuff with the js target.
3) Yes this is it. Here is a sample loader script:


File: loader.scm 
——————————————————————
(declare (standard-bindings)
         (extended-bindings)
         ;(fixnum) 
         (not safe))

(declare (not inline-primitives equal?))


; include Marc's code
(##include  “~/gambit/univ-lib/lib/lib.scm")         

; here you include your own modules
(include "Sentio.scm")
(include "Home.scm")
(include "Sentio-Localization.scm")
(include "Graph.scm")
(include "State-transitions.scm")
(include "Sentio-Forms.scm")
(include "Media.scm")
——————————————————————


You need to change the path to to univ-lib.scm

Then you compile this file with: 

/usr/local/Gambit-C/bin/gsc -:d-,f8,t8,-8 -c -target js loader.scm

I’m not sure now if this file in part of the gambit repo actually since this is so edgy. I will send you the file in a separate personal email to spare the list.

François






> On Feb 4, 2015, at 7:10 AM, Blake McBride <blake at mcbride.name> wrote:
> 
> Greetings,
> 
> Your response leads to several questions as follows:
> 
> 1.  Is there any documentation on all the stuff you have been telling regarding JS?  (It is okay if there is not.  I just don't want to keep bugging you if it's all documented and I just need to read it.)
> 
> 2.  I don't know what univ-lib is.  For example:
> 
> blake at sony-linux-laptop /usr/local/Gambit-C $ find . |grep -i univ
> blake at sony-linux-laptop /usr/local/Gambit-C $ 
> 
> blake at sony-linux-laptop ~/Backup/gambit.git $ find . |grep -i univ
> ./gsc/_t-univ.o
> ./gsc/_t-univ.scm
> ./gsc/_t-univ.c
> blake at sony-linux-laptop ~/Backup/gambit.git $ 
> 
> Are you talking about gsc/_t-univ.scm?
> 
> 
> 3.  With respect to JavaScript, I am not sure what you mean by "when you link with the universal library".  Do you mean load the universal library first?  Also, which file is that?  I'd rather not start creating a bunch of cover functions for standard scheme stuff if I don't have to.
> 
> I am sorry about all of these questions.  For reasons I mentioned elsewhere, JavaScript has become a very important platform.  It may not be bad as a small scripting language, but it certainly is not a full-bore production language like it is being used as.  I am looking into leveraging off of Gambit Scheme if possible.  Presumably, once I get a critical mass of functioning code and understanding, I will be able to work without all these pestering questions.
> 
> Thanks!
> 
> Blake
> 
> 
> 
> 
> On Tue, Feb 3, 2015 at 4:26 PM, Marc Feeley <feeley at iro.umontreal.ca <mailto:feeley at iro.umontreal.ca>> wrote:
> Yes.  That’s handled when you link with the universal library (in fact the current univ-lib will raise an exception in that case).  But if this is all you want to handle, just write your code like this:
> 
>   (define (##apply-global-with-procedure-check-nary gv . args)
>     (declare (standard-bindings))
>     (println (list "*** ERROR -- call to unbound global variable " gv))
>     (0)) ;; really crash!
> 
>   (foo 1 2 3)
> 
> The generated JS code calls the ##apply-global-with-procedure-check-nary function when a non-procedure bound to a global variable is called.
> 
> Marc
> 
> > On Feb 3, 2015, at 4:51 PM, Blake McBride <blake at mcbride.name <mailto:blake at mcbride.name>> wrote:
> >
> > Greetings,
> >
> > When running a JS target, if an unknown function is called, would it be possible to say something like:
> >
> > Error: call to unknown function XYZ
> >
> > Rather than:
> >
> > /home/blake/z/gambit/fib.js:348
> >     pc = pc();
> >          ^
> > TypeError: undefined is not a function
> >     at gambit_trampoline (/home/blake/z/gambit/fib.js:348:10)
> >     ......
> >
> >
> > Thanks.
> >
> > Blake McBride
> >
> 
> 
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150204/536cf861/attachment.htm>


More information about the Gambit-list mailing list