From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Amirouche Boubekki Newsgroups: gmane.lisp.guile.user Subject: Re: Summer of Code Recap Date: Thu, 07 Sep 2017 08:32:12 +0200 Message-ID: References: <40d9af53c985dfe680d8df822ace02a3@hypermove.net> <3380ffb801bde3cb8d4c4d60faacb5df@hypermove.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1504765984 17088 195.159.176.226 (7 Sep 2017 06:33:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 7 Sep 2017 06:33:04 +0000 (UTC) User-Agent: Roundcube Webmail/1.1.2 Cc: guile-user@gnu.org, guile-user To: Ian Price Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Sep 07 08:32:54 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dpqMr-0003ik-7u for guile-user@m.gmane.org; Thu, 07 Sep 2017 08:32:49 +0200 Original-Received: from localhost ([::1]:39002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpqMy-0003EF-84 for guile-user@m.gmane.org; Thu, 07 Sep 2017 02:32:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpqMX-0003Dk-Si for guile-user@gnu.org; Thu, 07 Sep 2017 02:32:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpqMU-0001Bn-OR for guile-user@gnu.org; Thu, 07 Sep 2017 02:32:29 -0400 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:52270) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpqMK-0001AK-5S; Thu, 07 Sep 2017 02:32:16 -0400 Original-Received: from webmail.gandi.net (webmail9-d.mgt.gandi.net [10.58.1.149]) (Authenticated sender: amirouche@hypermove.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPA id 16836FB887; Thu, 7 Sep 2017 08:32:12 +0200 (CEST) In-Reply-To: <3380ffb801bde3cb8d4c4d60faacb5df@hypermove.net> X-Sender: amirouche@hypermove.net X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.70.183.198 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14095 Archived-At: On 2017-09-06 20:25, Amirouche Boubekki wrote: > On 2017-09-02 00:09, Amirouche Boubekki wrote: >> On 2017-08-28 20:56, Ian Price wrote: >> >>> 1 Introduction >>> ============== >>> >>> As many of you are aware, I have been working on compiling Guile >>> Scheme to JavaScript this summer, as part of the Google Summer of >>> Code. This post serves to bookend my work for the year. >>> >>> Before I go any further, I have to give my thanks to my mentor >>> [Chris >>> Webber], without whom this project would have fizzled out weeks >>> ago; >>> Google and the Gnu Project, naturally, for providing the Summer of >>> Code and allowing me to work on this project; and our fearless >>> leader, >>> [Andy Wingo], for answering a wide variety of stupid questions. >>> >> >> Sorry, for my last mail I was a bit upset a minimal scm file with "42" >> will crash. >> >> Anyway, I did a bit of exploration: >> >> Apparently webkit does ship TCO and safari is the only browser [0] >> shipping it. >> So it will happen soon enough for chrome, but chrome is not a solution >> for many >> of us. I don't know when firefox with ship TCO. >> >> [0] https://www.chromestatus.com/feature/5516876633341952 >> >> Anyway, TCO requires "use strict"; thing to work, so I prefixed the >> output >> of guild jslink with that and it lead to discover a bug where there is >> two >> times the same argument called `v_rest`. You can run the file with >> the following command: >> >> node --harmony_tailcalls main.js >> >> It will tell you where the error is. >> >> Here is the fixed code: >> >> var k_27363 = function(v_19412, k_27499) { >> var k_27364 = function(v_19412, v_e, v_p, v_w, v_mod) { >> var v_19413 = v_e; >> var v_19414 = v_p; >> var v_19415 = v_w; >> var v_19416 = v_mod; >> if (scheme["is_true"](scheme["primitives"]["pair?"](v_19413))) >> { >> { >> var v_19417 = scheme["primitives"]["car"](v_19413); >> var v_19418 = scheme["EMPTY"]; >> scheme["primitives"]["handle-interrupts"](); >> var k_27370 = function(v_first, v_rest) { >> var v_19419 = v_first; >> var v_19420 = v_rest; >> if (scheme["is_true"](v_19419)) { >> { >> var v_19421 = scheme["primitives"]["cdr"](v_19413); >> scheme["primitives"]["handle-interrupts"](); >> var k_27375 = function(v_rest, v_rest2) { // The >> error is HERE! >> var v_19422 = v_rest; >> var v_19423 = v_rest2; >> >> With that "fix" it run under nodejs v8.4.0 without increasing the >> callstack. >> So it's good news! > > With both patches applied and "use strict"; prefixed to the output of > jslink > it works with chromium 60.0.3112.113 using the following command: > > chromium-browser --js-flags="--harmony-tailcalls" I pushed my changes to https://gitlab.com/amirouche/guile/tree/compile-to-js-2017 I am only missing `js-cloure` procedure to be able to submit guile callbacks to javascript world. -- Amirouche ~ amz3 ~ http://www.hyperdev.fr