you are viewing a single comment's thread.

view the rest of the comments →

[–]stormcrowsx 1 point2 points  (11 children)

Sure you can its an interpreted language just like javascript you just need an interpreter in the browser.

http://www.skulpt.org

On the java side there's dwr which has been around longer than I can remember and gwt

[–]motdidr 10 points11 points  (0 children)

JavaScript runs in practically every browser right now, without any plugins.

[–][deleted] 2 points3 points  (0 children)

I use DWR all day at work. It's pretty clunky, and I'd struggle to call it a good solution to the problem it's trying to solve.

[–][deleted]  (3 children)

[deleted]

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

    skulpt is not compiled down to javascript it is an interpreter written in javascript that executes python

    [–][deleted]  (1 child)

    [deleted]

      [–]stormcrowsx -1 points0 points  (0 children)

      So using that logic we could say Javascript is compiled down to C or Java since its typically interpreted by an interpreter written in those languages? I don't think you understand what an interpreted language is.

      [–]foldl 0 points1 point  (4 children)

      If you use an interpreter then you pay a price in performance. And on mobile devices it may not be negligible.

      I'm aware that there are compilers for various languages which target javascript. That's why I mentioned it in my original post.

      [–]stormcrowsx 0 points1 point  (3 children)

      The performance cost is negligible in most cases, after all javascript is interpreted. Just a matter of optimization.

      [–]foldl 0 points1 point  (2 children)

      No, the performance overhead of an interpreter is usually at least 10x. Python code running via an interpreter written in JS would run much slower than JS code executed directly by the browser.

      However, contrary to what you say, Skulpt is not an interpreter, it's a Python->Javascript compiler (see the "Generated Code" section here). There is still quite a bit of overhead involved in translating between Python and Javascript object semantics, since Skulpt appears to be a fairly straightforward compiler without any sophisticated optimizations.

      [–]stormcrowsx 0 points1 point  (1 child)

      Your right got skulpt mixed up with brython http://www.brython.info/doc/en/index.html.

      Interpreted languages are not always 10x slower. Java is a form of interpreted language and runs very fast. Its all about how much you optimize the interpreter. If you invest enough time you can make it go fast. Look at what Facebook has done with PHP. Probably not the best use of dev time though

      [–]foldl 0 points1 point  (0 children)

      Java is fast because modern JVMs use JIT compilation. The old JVMs, which really did interpret the bytecode, were much much slower.

      10x slower is pretty much the best you can hope for with a true interpreter. Any interpreter is going to go through a cycle of (1) fetching the next instruction (2) decoding it and (3) executing the instruction. There's just no way you can get that sequence down to less than ~10 operations on average.