unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Guile in the browser [Was: Summer of Code Recap]
@ 2017-09-11 20:31 Amirouche Boubekki
  0 siblings, 0 replies; only message in thread
From: Amirouche Boubekki @ 2017-09-11 20:31 UTC (permalink / raw)
  To: Guile User

Héllo all,

As you may know ijp was working during GSoC on a JavaScript
backend for Guile. What it means is that now, thanks to his
brillant work one can translate pure Guile to JavaScript and
run it in a browser supporting Tail Call Optimization (TCO).

After a looking up the web for ways to run JavaScript blob
generated by Guile in the browser I found that Chromium 60
does support TCO with the good option:

   chromium-browser --js-flags="--harmony-tailcalls"

There is prolly other chrome based browsers that will accept
that option. I only tested chromium 60 and chrome 60.

Sadly, that option is already phased out because dangerous [0].

Anyway, we can still play with it!

That's what I've done in a fork of ijp work. And implemented
some procedure to interop with javascript both ways. Which
means javascript can call guile and guile can call javascript.

AFAICT my previous work using biwascheme works. I did not test
that specific code, but my scheme todoMVC [1] could work with
guile js.

If you want to play with all that stuff, you can fetch my fork:

   https://gitlab.com/amirouche/guile/tree/compile-to-js-2017

Mind the fact that it's 'compile-to-js-2017' branch.

Then compile guile as usual.

Then run:

   $ make.sh forward.scm
   $ python3 -m http.server

And fire chromium:

   $ chromium-browser --js-flags="--harmony-tailcalls" \
                      --incognito \
                      http://localhost:8000

The incognito flag is to avoid caching.

And you will see an animated circle.

That's all for the time being. I will improve my 'forward' [2]
project to avoid some nasty race condition by following more
closely what elm does.

And eventually work on porting 2048 game.

That's all folks!

[0] https://bugs.chromium.org/p/v8/issues/detail?id=4698#c69
[1] https://amirouche.github.io/scheme-todomvc/
[2] https://github.com/a-guile-mind/forward

-- 
Amirouche ~ amz3 ~ http://www.hyperdev.fr



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-11 20:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 20:31 Guile in the browser [Was: Summer of Code Recap] Amirouche Boubekki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).