OCaml Installation Advice: Difference between revisions

From Xen
Jump to navigationJump to search
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<!-- MoinMoin name: OCaml_Advice -->
<!-- Comment: -->
<!-- WikiMedia name: OCaml Advice -->
<!-- Page revision: 00000001 -->
<!-- Original date: Thu Oct 8 18:13:14 2009 (1255025594000000) -->


__NOTOC__
<!-- ## Please edit system and help pages ONLY in the moinmaster wiki! For more -->
<!-- ## information, please see [[MoinMaster]]:[[MoinPagesEditorGroup]]. -->
<!-- ##master-page:[[Category:Template]] -->
<!-- ##master-date:Unknown-Date -->
<!-- #format wiki -->
<!-- #language en -->
== OCaml Installation Advice ==
=== Editable Top-Level ===
=== Editable Top-Level ===
OCaml provides a top-level (entered by running "ocaml") which is an excellent way to test code snippets. However, the ordinary interface lacks any editing features. This is most easily remedied using the ledit program by adding:
OCaml provides a top-level (entered by running "ocaml") which is an excellent way to test code snippets. However, the ordinary interface lacks any editing features. This is most easily remedied using the ledit program by adding:


<pre><nowiki>
<pre>
alias ocaml="ledit ocaml"
alias ocaml="ledit ocaml"
</nowiki></pre>
</pre>


to your startup scripts.
to your startup scripts.
Line 33: Line 20:


[[Category:OCaml]]
[[Category:OCaml]]
[[Category:XCP]]
[[Category:XAPI Devel]]
[[Category:Developers]]

Latest revision as of 13:13, 11 July 2013

Editable Top-Level

OCaml provides a top-level (entered by running "ocaml") which is an excellent way to test code snippets. However, the ordinary interface lacks any editing features. This is most easily remedied using the ledit program by adding:

alias ocaml="ledit ocaml"

to your startup scripts.

Emacs

Tuareg-mode

Although the OCaml distribution provides a simple editing mode for emacs, the Tuareg mode is better in many ways, including reliability.

Type Throwback

Types in ML programs are almost always inferred by the ML compiler. This greatly improves brevity but the lack of type information can be a hindrance to the programmer when developing software in ML. OCaml addresses this issue by providing a mechanism for type throwback. To use type throwback with emacs you can install the ocaml-mode package and then compile your code using the -dtypes compiler option. The key combination C-c C-t then brings up the inferred type of the current subexpression.

Eclipse

ocaIDE is a nice ocaml pluggin for Eclipse. You can go to the definition of any function in holding CTRL + left click. You can also have code auto-completion with CTRL+SPACE.