Giter VIP home page Giter VIP logo

Comments (6)

bakpakin avatar bakpakin commented on May 12, 2024

It’s an interesting idea and there are a lot of ways to go about it.

  • Run Janet via JNI and allow communication with Java
  • Reimplement Janet in Java, sans GC. The code would probably be simpler as well if we reused Java concepts.
  • Same as above, but compile Janet bytecode to Java bytecode. I’m not sure If this would be easy or very difficult.
  • write another compiler to emit Java bytecode directly from the Janet source. This would actually might be easier than translating from one bytecode to another.

I’m not sure what the most useful approach would be, but the first is probably the least amount of work, as the runtime doesn’t need to be rewritten.

All that said, porting to the JVM is not really a goal right now unless someone wanted to spearhead that effort.

from janet.

zcaudate avatar zcaudate commented on May 12, 2024

I had assumed that the c byte code provides an intermediary for targeting various virtual machines (llvm,jvm, custom hardware etc).

Am I wrong in thinking that?

from janet.

zcaudate avatar zcaudate commented on May 12, 2024

For me, there is a serious need for an clojure compiler - mainly for targeting android. It’s rather a long term thing but I’d like that problem solved.

If that were possible I have a feeling that many clojure devs that would jump onboard. I’m not sure what your goals are for Janet but this is something to consider.

Honestly, if I had a knowledge to write a compiler, I would have done it by now.

from janet.

bakpakin avatar bakpakin commented on May 12, 2024

No, the bytecode is executed directly by the interpreter. To really port Janet to the JVM, one would probably have to rewrite the entire language in Java.

Can Clojure not do AOT compilation on Android? I would have assumed that would be easily possible.

from janet.

bakpakin avatar bakpakin commented on May 12, 2024

I had assumed that the c byte code provides an intermediary for targeting various virtual machines (llvm,jvm, custom hardware etc).

llvm isn't a virtual machine. It is a compiler intermediate representation. The bytecode that the Janet compiler produces is run in a bytecode interpreter.

Janet is not really looking to be at all compatible with Clojure. Clojure has some cool ideas, and many other ideas that are infeasible without a really good compiler (GHC) or a really good JITting runtime (JVM). Janet will never have lazy sequences as a core abstraction because they are too slow. Clojure jumps through many hoops to make them reasonably fast, like using chunked sequences, and that is already considering the Clojure is implemented on top of the JVM, which is good at optimizing code that produces a lot of garbage.

If you are looking for a static Clojure compiler, look elsewhere. If you are looking for a kind-of Clojure-like language that can run on the JVM, Janet is not there yet, and probably won't ever be unless someone else works on that.

from janet.

zcaudate avatar zcaudate commented on May 12, 2024

Thanks for the clarifications. And congrats on the amazing work with Janet. It’s finally got me excited about clojure again.

from janet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.