Skip to content

Comment on Polycompiler: Merge Python and JavaScript code into one file that runs in both

Comments

Ok, now write your code in a metalanguage(i believe fut might work), and now we can write once and run on two different engines.

Maybe we can convince Marc Feeley to write a backend for Gambit that targets this.

Hey, I'm writing this from Pr Feeley's lab :)

I understand your comment was tongue-in-cheek, but we certainly have an interest in cross-language interoperability! You can check out our work here:

- https://try.gambitscheme.org is Gambit compiled to JavaScript with the universal backend. Evaluate \alert("hello!") at the REPL to see the JS<->Scheme Syntactic FFI in action.

- https://codeboot.org is our own Python interpreter running in the browser. It has a Python<->JS FFI. Evaluate \alert("hello!") at the REPL to test it out. You can even import JS libraries using the standard Python syntax by replacing the identifier with a string: import "https://mycdn.com/mylibrary.js".

- https://github.com/gambit/python is a Gambit module that integrates Gambit with CPython, using the same syntactic FFI. You can import PyPI modules from Gambit.

References to conferences/papers describing these features can be found on my GH profile (https://github.com/belmarca). AMA if you wish!

It was more "ha ha only serious" than purely tongue-in-cheek. I'm familiar with Gambit's multi-backend targeting and have experimented with its JS backend. I consider it one of the quickest, and most comprehensive, ways to get "Scheme in the browser".

BTW I'd love to hear your feedback if you have tried the above examples!

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.