[HN Gopher] Racketscript: Racket to JavaScript Compiler
___________________________________________________________________
Racketscript: Racket to JavaScript Compiler
Author : lycopodiopsida
Score : 65 points
Date : 2021-09-26 16:18 UTC (6 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| tpfour wrote:
| I see this is a WIP without support for the Scheme numerical
| tower, tail calls, continuations, etc. If you're looking for such
| features, Gambit Scheme can compile to JS with those features
| working and comes at ~600kb gzipped (for the _whole_ system). You
| can see it in action at https://try.gambitscheme.org but I don't
| know if it's the latest version.
| nerdponx wrote:
| I didn't know Gambit compiled to Javascript. Can you call
| Javascript foreign functions? Can you use "advanced" Javascript
| libraries like React?
| jhgb wrote:
| Sadly "I didn't know Gambit could do X" seems to be a
| frequent sentiment considering the project's documentation.
| The configure script hints at many a feature that isn't
| described anywhere.
| gus_massa wrote:
| Implementing the numerical tower is not too difficult. There
| may be some problems to ensure fixnums are singletons and
| bignums are efficient, but it looks possible.
|
| Tail calls and continuations are more difficult if you want
| them to be efficient.
| caltelt wrote:
| Yep, basically. I looked into Racketscript a while ago, seems
| like it was a graduate thesis project that heavily built off of
| a similar python project iirc. It's based on a very old version
| of rkt, pre-chez, and probably would need a huge investment
| just to work with the newer ecosystem.
|
| Iirc, an interesting bullet-point in their backend rework to
| make the move to chez meant that doing things like targeting js
| might be easier now than ever. I would absolutely love a js
| backend for rkt, it seems like it would be a huge boon to the
| ecosystem.
| capableweb wrote:
| > I see this is a WIP
|
| Great, then we know at least two people know how to read :)
|
| From the README: "RacketScript is an ___experimental____
| lightweight Racket to JavaScript"
|
| > https://try.gambitscheme.org/
|
| For some folks who'd like me to trust their web knowledge,
| having an expired certificate certainly doesn't give me any
| more trust than I already had.
|
| More on topic: I wonder how the REPL story is with
| Racketscript? Nothing seems to be mentioned in the README nor
| in the repository which would make this project a non-starter
| for the people who got used to ClojureScript and similar
| efforts.
| diskzero wrote:
| That is a bummer about the expired certificate. You can
| access the site using http instead of https if you are
| comfortable doing so. I have never seen this live REPL before
| and have just used their Github repo to get the latest:
| https://github.com/gambit/gambit
|
| I think it is great someone is trying to get Racket compiling
| to Javascript again. I also agree with you about the REPL;
| while it is interesting to compile Racket to JS, having a
| REPL, a live environment and all the features of something
| like ClojureScript has much more utility.
| bjoli wrote:
| On a similar note, there is a branch in the guile git repo that
| aims at compiling to JS. It does a pretty nifty compilation pass
| that constructs a kind of minimal CPS where all calls are tail
| calls, giving instant support for delimited continuations and
| very simple (yet not fantastically fast) tail calls even in hosts
| that doesnt support it (using a trampoline).
|
| Meaning, hopefully, full guile in the browser.
| nerdponx wrote:
| Is there a Scheme targeting Webassembly yet?
| lf-non wrote:
| There is a WIP unofficial project from developers at Google
| called Schism [1].
|
| [1] https://github.com/schism-lang/schism
| jagger27 wrote:
| Grain is a fully functional language that exclusively targets
| WebAssmebly. It isn't a Scheme though. It's already a very
| mature project with some external funding.
|
| https://grain-lang.org/
| Zababa wrote:
| How is Grain "very mature"? Is there a package manager? A
| language server? A complete standard library? An ecosystem
| of libraries?
| bjoli wrote:
| The scheme standard mandates things that are not in the wasm
| spec yet (tail calls and GC being probably the most notable
| ones, being available only in chrome).
|
| There are quite a few open questions regarding RnRS schemes
| on webassembly. Currently it seems that the ones available
| are either discouraged by the limitations of wasm, or are
| implemented to specifically test non-standard proposals of
| wasm.
|
| In other words: no fun at all.
___________________________________________________________________
(page generated 2021-09-26 23:00 UTC)