1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.8">
<title>OCaml</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">
<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css"/>
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20130715</a>
</div>
</div>
<div id="header">
<h1>OCaml</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p><a href="http://caml.inria.fr/">OCaml</a> is a variant of <a href="ML">ML</a> and is similar to
<a href="StandardML">Standard ML</a>.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_ocaml_and_sml">OCaml and SML</h2>
<div class="sectionbody">
<div class="paragraph"><p>Here’s a comparison of some aspects of the OCaml and SML languages.</p></div>
<div class="ulist"><ul>
<li>
<p>
Standard ML has a formal <a href="DefinitionOfStandardML">Definition</a>, while
OCaml is specified by its lone implementation and informal
documentation.
</p>
</li>
<li>
<p>
Standard ML has a number of <a href="StandardMLImplementations">compilers</a>,
while OCaml has only one.
</p>
</li>
<li>
<p>
OCaml has built-in support for object-oriented programming, while
Standard ML does not (however, see <a href="ObjectOrientedProgramming">ObjectOrientedProgramming</a>).
</p>
</li>
<li>
<p>
Andreas Rossberg has a
<a href="http://www.mpi-sws.org/%7Erossberg/sml-vs-ocaml.html">side-by-side
comparison</a> of the syntax of SML and OCaml.
</p>
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_ocaml_and_mlton">OCaml and MLton</h2>
<div class="sectionbody">
<div class="paragraph"><p>Here’s a comparison of some aspects of OCaml and MLton.</p></div>
<div class="ulist"><ul>
<li>
<p>
Performance
</p>
<div class="ulist"><ul>
<li>
<p>
Both OCaml and MLton have excellent performance.
</p>
</li>
<li>
<p>
MLton performs extensive <a href="WholeProgramOptimization">WholeProgramOptimization</a>, which can
provide substantial improvements in large, modular programs.
</p>
</li>
<li>
<p>
MLton uses native types, like 32-bit integers, without any penalty
due to tagging or boxing. OCaml uses 31-bit integers with a penalty
due to tagging, and 32-bit integers with a penalty due to boxing.
</p>
</li>
<li>
<p>
MLton uses native types, like 64-bit floats, without any penalty
due to boxing. OCaml, in some situations, boxes 64-bit floats.
</p>
</li>
<li>
<p>
MLton represents arrays of all types unboxed. In OCaml, only
arrays of 64-bit floats are unboxed, and then only when it is
syntactically apparent.
</p>
</li>
<li>
<p>
MLton represents records compactly by reordering and packing the
fields.
</p>
</li>
<li>
<p>
In MLton, polymorphic and monomorphic code have the same
performance. In OCaml, polymorphism can introduce a performance
penalty.
</p>
</li>
<li>
<p>
In MLton, module boundaries have no impact on performance. In
OCaml, moving code between modules can cause a performance penalty.
</p>
</li>
<li>
<p>
MLton’s <a href="ForeignFunctionInterface">ForeignFunctionInterface</a> is simpler than OCaml’s.
</p>
</li>
</ul></div>
</li>
<li>
<p>
Tools
</p>
<div class="ulist"><ul>
<li>
<p>
OCaml has a debugger, while MLton does not.
</p>
</li>
<li>
<p>
OCaml supports separate compilation, while MLton does not.
</p>
</li>
<li>
<p>
OCaml compiles faster than MLton.
</p>
</li>
<li>
<p>
MLton supports profiling of both time and allocation.
</p>
</li>
</ul></div>
</li>
<li>
<p>
Libraries
</p>
<div class="ulist"><ul>
<li>
<p>
OCaml has more available libraries.
</p>
</li>
</ul></div>
</li>
<li>
<p>
Community
</p>
<div class="ulist"><ul>
<li>
<p>
OCaml has a larger community than MLton.
</p>
</li>
<li>
<p>
MLton has a very responsive
<a href="http://www.mlton.org/mailman/listinfo/mlton">developer list</a>.
</p>
</li>
</ul></div>
</li>
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
|