[gambit-list] Improving error reporting

Blake McBride blake at mcbride.name
Wed Feb 4 07:10:07 EST 2015


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> 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> 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
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150204/e97ad632/attachment.htm>


More information about the Gambit-list mailing list