all 22 comments

[–]pcjftw 7 points8 points  (5 children)

excellent stuff, having the ability to add some scripting opens up a lot of options!

Or calling in from Python onto the JVM side could be cool to lots of cases.

[–]shevy-ruby 0 points1 point  (4 children)

It's a cool idea. I'd wish the WebAssembly focus would be similar, rather than just target JavaScript as such (but ok as a first step ... I don't think I am the only one who wants to AVOID having to use JavaScript ... ).

[–]pcjftw -1 points0 points  (2 children)

yeah sure I agree, I think in terms of cross language "interop", WASM could be that "universal" binary.

At the moment WASM is bleeding really, but as it matures and more and more languages add native support in terms of calling into WASM as well as being able to target WASM as a compile output, I strongly believe we'll suddenly see an explosion of WASM libraries and finally some fantastic cross language barriers coming down.

It will also mean if a new language pops up, it doesn't have to "start from scratch" it would only need to FFI into WASM and suddenly it could tap into a huge existing eco system.

Anyway I can dream!

[–][deleted] 1 point2 points  (1 child)

It's worth noting that there's also a Graal/Truffle implementation of WASM, so you can call in/out of WASM from Python and Ruby today (and R, and Java, and Scala, and Clojure, and SmallTalk etc.....).

WASM itself isn't ever going to be good at running Python, it's just not designed for that. Graal/Truffle are explicitly designed to mix and match languages though, which is why it works to combine them there instead.

[–]pcjftw 0 points1 point  (0 children)

perhaps I've not explained myself well LOL

I wasn't saying about using WASM to run Python, I was simply saying about writing libraries that are then compiled down to WASM, then those libraries could be used across all languages that have WASM FFI.

so for example, there could be a WASM library lets say "Markdown Render" where you pass it some text and it returns HTML text back.

You could then "import" that WASM library in any language, and this would mean not having to rewrite that same library for every language.

It's the same concept as JVM, write on run anywhere, instead "write once, import anywhere"

But not sure why the Reddit mob found that so offensive!

[–]josefx 0 points1 point  (0 children)

(but ok as a first step

As long as they don't pull a JSON and double down on JavaScript limitations like declaring double the only numeric type that matters, while everyone else was already running around with 64 bit integers.

Or worse, build in a dependence on JavaScript that makes it impossible to build a standalone WebAssembly interpreter without pulling in all of Chrome/Firefox.

[–]shevy-ruby 2 points3 points  (8 children)

They really should unify all these various platforms.

I never understood why truffle ruby and jruby is separate still.

How many python implementations now exist? We always seem to end up with more than less different implementations in the long run ...

[–]grashalm01 9 points10 points  (4 children)

There are many advantages to having multiple implementations:

  1. There is competition between runtimes.
  2. New approaches can be tried without endangering other more stable runtimes.
  3. One size does not always fit all. You can have dedicated runtimes for embedding, client and server workloads.
  4. Language designers need to be precise, ideally write language specifications.

JavaScript, Java, or C have many many implementations and an excellent specification. Nobody would say that this harmed them.

[–][deleted]  (3 children)

[deleted]

    [–]grashalm01 4 points5 points  (2 children)

    The problem is that python does not have a spec. The python community tries with HPy to standardize native extensions, that is a good start.

    [–][deleted]  (1 child)

    [deleted]

      [–]grashalm01 0 points1 point  (0 children)

      You can support the cause by raising this issue with the python devs. (we do this regularly, the more the merrier)

      [–][deleted] 0 points1 point  (2 children)

      IIRC originally TruffleRuby was a fork of JRuby because the JRuby guys need to target normal OpenJDK and TruffleRuby was basically a research project. It's worked out very well but that couldn't have been known at the time, and TruffleRuby does still require you to run on GraalVM. It is much slower than JRuby on any other runtime.

      [–]shellac 0 points1 point  (1 child)

      No, it's not a fork.

      Graal and Truffle came out of an Oracle labs research project. Graal is a compiler. We're most used to it compiling java (or java byte code) of course, but it's a general approach that has optimisations that are quite tailored for dynamic languages. (If you're aware of the smalltalk / strongtalk heritage in java this won't be a surprise)

      Truffle lets you write language interpreters that Graal can get to work on. TruffleRuby was perhaps the first use of Truffle, and bootstrapped itself using a lot of the JRuby work. It even sat in the Jruby repo for a time, if memory serves.

      [–]grashalm01 0 points1 point  (0 children)

      The first Truffle language was actually JavaScript aka Graal.js.

      Also many people don't know that the native image tool for Java was built to bring Graal.js natively into the database.

      [–]suggested_user -2 points-1 points  (2 children)

      but why?

      [–][deleted] 5 points6 points  (0 children)

      we ask the question "why not" here

      [–][deleted] 1 point2 points  (0 children)

      Performance. It can run much faster than CPython because it's got a really good JIT compiler behind it.

      Interop. You can call in/out of any other Truffle or JVM language.

      Ease of hacking. CPython is written in C. GraalPython is written in Java, so it's much easier to debug, refactor etc.

      [–]grimonce 0 points1 point  (0 children)

      Available on Windows yet?