Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP oCaml language support #155

Closed
wants to merge 5 commits into from
Closed

Conversation

dvberkel
Copy link
Contributor

This is very much work in progress. Feedback is much appreciated.

@dvberkel
Copy link
Contributor Author

Progress made towards #148.

I haven't tested this and I still need to require klipse.lang.ocaml in the places mentioned at How to add a language to klipse. I figured that early feedback is most beneficial. Any tips, hints and feedback is much appreciated

@dvberkel
Copy link
Contributor Author

How are individual languages tested?

@viebel
Copy link
Owner

viebel commented Dec 14, 2016

Take a look at the test page for javascript: https://github.com/viebel/klipse/blob/master/resources/public/js-dbg.html

(def eval-opts {:editor-in-mode "text/ocaml"
:editor-out-mode "javascript"
:eval-fn eval-ocaml
:external-csripts [(codemirror-mode-src "ocaml") "http://bloomberg.github.io/bucklescript/js-demo/exports.js"]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to host the ocaml compiler javascript file on klipse repo.
Can you open a separate pull request for adding export.js to the docs/repo/js folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! Will do as soon as possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It landed in pull request #156

@viebel
Copy link
Owner

viebel commented Dec 14, 2016

I have made a couple of improvements and stuff is starting to work.
You can cherry pick this commit 0f23d41

@dvberkel
Copy link
Contributor Author

I cherry picked your improvements

@dvberkel
Copy link
Contributor Author

What needs to be done before this can be merged. I have some time later tonight to work on this, but have no clear direction to work in

@viebel
Copy link
Owner

viebel commented Dec 18, 2016

So cool that you have time tonight for ocaml.

For the moment, the transpilation works fine.

The evaluation works in a weird way. As far as I understand (and I have no knowledge at all in Ocaml) in order for a snippet to be evaluated properly, it must end by a let () = ... statement and this statement must have a side effect e.g. JS.log.

The trick I did, in order to see the Js.log result is with my-with-redefs (redirect console.log to the result snippet).

Also, it seems that symbols are not shared between snippets.

The best would be for you to write a blog post that teaches the basics of ocaml and see how convenient it is to use the klipse snippet. And if something is not convenient, then fix the ocaml support in klipse.

Makes sense?

@dvberkel
Copy link
Contributor Author

Totally makes sense, although I am confused. Did oCaml support already land in the master branch? Or should I build a local copy of the plugin?

@viebel
Copy link
Owner

viebel commented Dec 18, 2016

Not yet on master.
You need to build a local copy with ./scripts/build

@viebel
Copy link
Owner

viebel commented Dec 21, 2016

Any progress @dvberkel ?

I have played with it a bit a found a couple of issues:

  1. In order to display something, one has to use Js.log or end the code snippet with something like let a=1+1;. It would be better to evaluate statements like 1+1.

  2. Variables definitions are not shared between code snippets.

  3. The type of the data is not displayed.

@viebel
Copy link
Owner

viebel commented Dec 21, 2016

I have opened an issue on tryocaml OCamlPro/tryocaml#167
They might help

@dvberkel
Copy link
Contributor Author

I made some progress, but got side tracked integrating klipse in my blog. I wrote a blog post with clojure in mind to see what is to be expected.

I will take a look into tryocaml and their environment

@viebel
Copy link
Owner

viebel commented Oct 5, 2017

@dvberkel Thanks for your initiative. Now Klipse supports Ocaml and ReasonML. See http://blog.klipse.tech/ocaml/2017/10/05/blog-ocaml.html

@viebel viebel closed this Oct 5, 2017
@dvberkel
Copy link
Contributor Author

Congratulations! Sorry that I couldn't find the time to bring this to fruitation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants