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@sony-linux-laptop /usr/local/Gambit-C $ find . |grep -i univ
blake@sony-linux-laptop /usr/local/Gambit-C $ 

blake@sony-linux-laptop ~/Backup/gambit.git $ find . |grep -i univ
./gsc/_t-univ.o
./gsc/_t-univ.scm
./gsc/_t-univ.c
blake@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@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@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
>