The AI Works community logo The Blockchain Works community logo The Functional Works community logo The Golang Works community logo The Java Works community logo The JavaScript Works community logo The Python Works community logo The Remote Works community logo The WorksHub company logo

We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies.

We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies. Less

We use cookies and other tracking technologies... More

Login or register
to publish this job!

Login or register
to save this job!

Login or register
to save interesting jobs!

Login or register
to get access to all your job applications!

Login or register to start contributing with an article!

Login or register
to see more jobs from this company!

Login or register
to boost this post!

Show some love to the author of this blog by giving their post some rocket fuel 🚀.

Login or register to search for your ideal job!

Login or register to start working on this issue!

Login or register
to save articles!

Login to see the application

Engineers who find a new job through JavaScript Works average a 15% increase in salary 🚀

You will be redirected back to this page right after signin

Bind `cljs.js` dynamic vars before `eval`

Issue Open
Pull requests: 0
Contributors: 0
Level: Intermediate
  • Clojure
Issue Open
Pull requests: 0
Contributors: 0
Level: Intermediate
  • Clojure

On GitHub

Klipse is a Javacript plugin for embedding interactive code snippets in tech blogs. A simple client-side code evaluator pluggable on any web page: clojure, ruby, javascript, python, scheme, es2017, jsx, brainfuck, c++, reagent, lua, ocaml, reasonml, prolog, common lisp
More info >

Issue posted by: 
moxaj's avatar

Viktor Magyari

Description

I have a proof of concept project which I'm testing with various self-hosted envs, and it does not work with klipse. I believe some minor modifications could be made to the way expressions are currently compiled and evaluated, which might benefit klipse as well (so it's not entirely for my own selfish reasons :))

The cause of this issue is that klipse does not directly set or bind cljs.js/*load-fn* and cljs.js/*eval-fn*, but simply passes them to cljs.js/eval-str. Therefore, client code which uses cljs.js is restricted (require expressions cannot be eval-d for instance).

The solution would be to simply bind or set these vars before making the eval-str call.

Also, the current implementation uses async channels to hold the result. I believe these could safely be replaced with refs (lumo and planck use volatiles). Besides being simpler, it would also enable the use of binding (which is arguably better than set!).

If you have no objections, I can put together a PR for you to review.

    Use Open Source to hire or get hired

    On GitHub

    Klipse is a Javacript plugin for embedding interactive code snippets in tech blogs. A simple client-side code evaluator pluggable on any web page: clojure, ruby, javascript, python, scheme, es2017, jsx, brainfuck, c++, reagent, lua, ocaml, reasonml, prolog, common lisp
    More info >

    Issue posted by: 
    moxaj's avatar

    Viktor Magyari

    Use Open Source to hire or get hired

    Bind `cljs.js` dynamic vars before `eval`
    View on GitHub