5 ms·
The Java ecosystem's JSR 223 is something to look at (at least for hosted languages with a canonical object system).
by _pmf_ 8y ago
The Java ecosystem's JSR 223 is something to look at (at least for hosted languages with a canonical object system).
- merb 8y agonot as impressive as Graal.
- mpweiher 8y agoYes, sort of. Or maybe kind of not? I am not sure I'd call what Graal is doing "interoperability", because you essentially pull everything into that VM, instead of interoperating with it where it is. So they "interoperate" with C by making a C compiler that creates a Graal-compatible AST, and as far as I can tell, the only way of interoperating at this point is creating a new Graal compiler.
- Apanatshka 8y agoWhat I've gathered about Graal is that once you have a compiler for the platform, Cross-Language communication on a hot path gets optimised to near-zero cost.
- mpweiher 8y agoExactly. You're not really crossing boundaries any more, you just have different surface-syntaxes for "the Graal language system".
- merb 8y agowell your statement is neither true nor is it false. See: http://www.graalvm.org/docs/reference-manual/languages/llvm/ http://www.graalvm.org/docs/reference-manual/languages/llvm/ for example. Basically you generate bitcode and can run the bitcode on graal. However you can still load native libraries into Graal and access them, you can't probably access them directly in java without a wrapper (I'm not sure about that yet). So basically you compile your C/C++/Rust Code to BitCode instead of Object Files/Binaries and run that BitCode on Graal. I.e. with java: Context polyglot = Context.newBuilder() .allowAllAccess(true) .option("llvm.libraries", "/usr/lib/libcurl.dylib") .build(); Source source = Source.newBuilder("llvm", new File("hello.bc")).build(); Value cpart = polyglot.eval(source); cpart.getMember("main").execute(); Whereas hello.gc is: #include <stdio.h> #include <curl/curl.h> int main() { CURL *curl = curl_easy_init(); if(curl) { CURLcode res; curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); http://example.com"); res = curl_easy_perform(curl); curl_easy_cleanup(curl); } printf("Hello from GraalVM!\n"); return 0; }
- _pmf_ 8y agoI have used one, but not the other, so this is not a comment on whether Graal is as good or not as good, but along the line "they did it right with the previous system, so there's hope to get it right this time, too".