guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Guile in the browser [Was: Summer of Code Recap]


From: Amirouche Boubekki
Subject: Guile in the browser [Was: Summer of Code Recap]
Date: Mon, 11 Sep 2017 22:31:24 +0200
User-agent: Roundcube Webmail/1.1.2

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]