<div dir="ltr"><div>Thanks a lot! Latest Gambit fix the issue I had.</div><div><br></div><div>ref: <a href="https://scheme-live.github.io/scheme-fuss/">https://scheme-live.github.io/scheme-fuss/</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le sam. 20 juil. 2019 à 23:05, Marc Feeley <<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Quasiquote works when you link with the Gambit runtime library.  If you have a custom library you need to define the procedures needed by quasiquote:<br>
<br>
(define (##quasi-append lst1 lst2) (append lst1 lst2))<br>
(define (##quasi-list . lst) lst)<br>
(define (##quasi-cons obj1 obj2) (cons obj1 obj2))<br>
(define (##quasi-list->vector lst) (list->vector lst))<br>
(define (##quasi-vector . lst) (list->vector lst))<br>
(define (append lst1 lst2) …)<br>
(define (list->vector lst) …)<br>
<br>
(define x `(1 ,(fx+ 2 3) 4))<br>
<br>
(println (cadr x))<br>
<br>
It will be a bit harder to get syntax-case working with the JS backend because macro definitions cause the generation of a residual call to $sc-put-cte and that would have to be implemented.  It might help to contact the authors of psyntax to see if this can be avoided (I think it can but don’t know exactly how).<br>
<br>
Concerning your issue with your counter web app, I suspect it might be due to an incorrect optimization by the JS backend of the create-app procedure’s lambdas.  The tails of two of those lambdas return #t and the compiler is mergin those in the same basic block.  Could you change one of the two #t to 'true, which shouldn’t affect the working of the app but prevents the optimization.  If that works I’ll look into it further.<br>
<br>
Marc<br>
<br>
<br>
<br>
> On Jul 20, 2019, at 1:05 PM, Amirouche Boubekki <<a href="mailto:amirouche.boubekki@gmail.com" target="_blank">amirouche.boubekki@gmail.com</a>> wrote:<br>
> <br>
> I would like to work on the JavaScript Backend.<br>
> <br>
> I started porting my work from JavaScript and other Schemes that rely on ReactJS<br>
> to Gambit:<br>
> <br>
> <a href="https://github.com/scheme-live/scheme-fuss" rel="noreferrer" target="_blank">https://github.com/scheme-live/scheme-fuss</a><br>
> <br>
> This is the very basic and doesn't support calling the backend yet. I<br>
> am confident I can<br>
> achieve it (along all the things that are listed in the issues), but I<br>
> am hitting some problems.<br>
> <br>
> In particular the following features are not available:<br>
> <br>
> - quasiquote: this would allow to easily express html in s-expr (sxml)<br>
> <br>
> - syntax-case: this would allow to adapt some of my previous work<br>
>  involving R7RS libraries.<br>
> <br>
> Also, I upgraded my demo application to implement an application of "counter".<br>
> <br>
> It fails after the 10th click on increment button:<br>
> <a href="https://scheme-live.github.io/scheme-fuss/" rel="noreferrer" target="_blank">https://scheme-live.github.io/scheme-fuss/</a><br>
> <br>
> <br>
> tl;dr: Let me know what you think and how I can put my (plenty of)<br>
> time to good use?<br>
> <br>
> <br>
> Thanks for the great work!<br>
> <br>
> ---------- Forwarded message ---------<br>
> De : Marc Feeley <<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>><br>
> Date: ven. 19 juil. 2019 à 17:37<br>
> Subject: Re: [gambit-list] Information about the Gambit-C Javascript Backend<br>
> To: Amirouche Boubekki <<a href="mailto:amirouche.boubekki@gmail.com" target="_blank">amirouche.boubekki@gmail.com</a>><br>
> Cc: Paulo Silva Filho <<a href="mailto:paulosfilho@gmail.com" target="_blank">paulosfilho@gmail.com</a>>, gambit-list<br>
> <<a href="mailto:gambit-list@iro.umontreal.ca" target="_blank">gambit-list@iro.umontreal.ca</a>><br>
> <br>
> <br>
> Like so:<br>
> <br>
> % cd gambit<br>
> % cd lib<br>
> % make _gambit.js<br>
> ../gsc/gsc -:~~bin=../bin,~~lib=../lib,~~include=../include -f -target<br>
> js  -prelude "(define-cond-expand-feature|enable-type-checking|)(define-cond-expand-feature|disable-auto-forcing|)(define-cond-expand-feature|enable-sharp-dot|)(define-cond-expand-feature|enable-bignum|)(define-cond-expand-feature|enable-ratnum|)(define-cond-expand-feature|enable-cpxnum|)(define-cond-expand-feature|disable-smp|)(##include\"../lib/header.scm\")"<br>
> -o _gambit.js ../lib/_univlib.scm<br>
> % cd ..<br>
> % gsc/gsc -:=. -target js -exe app.scm<br>
> % ./app<br>
> 1<br>
> 256<br>
> 65536<br>
> 16777216<br>
> 4294967296<br>
> 1099511627776<br>
> 281474976710656<br>
> 72057594037927936<br>
> 18446744073709551616<br>
> 4722366482869645213696<br>
> 1208925819614629174706176<br>
> 309485009821345068724781056<br>
> 79228162514264337593543950336<br>
> 20282409603651670423947251286016<br>
> 5192296858534827628530496329220096<br>
> 1329227995784915872903807060280344576<br>
> 340282366920938463463374607431768211456<br>
> 87112285931760246646623899502532662132736<br>
> 22300745198530623141535718272648361505980416<br>
> 5708990770823839524233143877797980545530986496<br>
> % cat app.scm<br>
> (define n 20)<br>
> (for-each (lambda (i)<br>
>            (println (object->string (expt 2 (* i 8)))))<br>
>          (iota n))<br>
> (exit)<br>
> <br>
> This should work for the other backends too.  Note that there’s some<br>
> bit rot of lib/univlib.scm, so there are issues with some parts of the<br>
> Gambit library (for example write and pretty-print are broken, (exit)<br>
> is needed to avoid an exception on exit, etc).  You can revert to<br>
> previous recent releases of Gambit to get these working correctly.<br>
> <br>
> Sorry but lots of things are in flux right now…<br>
> <br>
> Marc<br>
> <br>
> <br>
> <br>
>> On Jul 19, 2019, at 11:08 AM, Amirouche Boubekki <<a href="mailto:amirouche.boubekki@gmail.com" target="_blank">amirouche.boubekki@gmail.com</a>> wrote:<br>
>> <br>
>> Sorry for the multiple emails!<br>
>> <br>
>> Le ven. 19 juil. 2019 à 13:38, Marc Feeley <<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>> a écrit :<br>
>> You should look at this recent thread: <a href="https://mailman.iro.umontreal.ca/pipermail/gambit-list/2019-July/009103.html" rel="noreferrer" target="_blank">https://mailman.iro.umontreal.ca/pipermail/gambit-list/2019-July/009103.html</a><br>
>> <br>
>> In the above mail thread, it is described how to compile a scheme file into javascript WITHOUT "Gambit runtime".<br>
>> <br>
>> Q: How can I bundle the Gambit runtime into the compiled JavaScript file?<br>
>> <br>
>> <br>
>> Thanks in advance!<br>
> <br>
> <br>
> <br>
> <br>
> -- <br>
> Amirouche ~ amz3 ~ <a href="https://hyper.dev" rel="noreferrer" target="_blank">https://hyper.dev</a><br>
> <br>
> _______________________________________________<br>
> Gambit-list mailing list<br>
> <a href="mailto:Gambit-list@iro.umontreal.ca" target="_blank">Gambit-list@iro.umontreal.ca</a><br>
> <a href="https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list" rel="noreferrer" target="_blank">https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list</a><br>
<br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Amirouche ~ amz3 ~ <a href="https://hyper.dev" target="_blank">https://hyper.dev</a><br></div></div>