<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>assets/reasons-for-rewriting-in-rust.md - fork/numbat @ master</title>
<meta name="description" content="assets/reasons-for-rewriting-in-rust.md in fork/numbat at master.">
<meta property="og:title" content="assets/reasons-for-rewriting-in-rust.md - fork/numbat @ master">
<meta property="og:description" content="assets/reasons-for-rewriting-in-rust.md in fork/numbat at master.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="master" data-tip="b070b880c8a713bac881084034ea6f0d857868ed">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>fork/numbat</h1>
</div>
<pre class="clone">git clone https://git.julia.blue/fork/numbat</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">Mohammed Anas</span><span class="commit-message" data-commit="a4d6d2668b22ac540fcea5e93e8d33a67d860cef">Minor changes to docs</span><span class="snapshot-sha sha" data-commit="a4d6d2668b22ac540fcea5e93e8d33a67d860cef">a4d6d26</span><time datetime="2023-10-25T17:14:15+01:00" title="2023-10-25 17:14:15 +0100">2023-10-25</time></p>
<header class="topbar"><details class="switcher"><summary>master</summary><div class="menu"><strong>branches</strong><a class="current" href="/fork/numbat/ref/master/">master</a><strong>tags</strong><a href="/fork/numbat/ref/v1.6.0/">v1.6.0</a><a href="/fork/numbat/ref/v1.6.1/">v1.6.1</a><a href="/fork/numbat/ref/v1.6.2/">v1.6.2</a><a href="/fork/numbat/ref/v1.6.3/">v1.6.3</a><a href="/fork/numbat/ref/v1.7.0/">v1.7.0</a><a href="/fork/numbat/ref/v1.8.0/">v1.8.0</a><a class="all" href="/fork/numbat/refs">all refs →</a></div></details><nav class="crumbs"><a href="/fork/numbat/">numbat</a> / <a href="/fork/numbat/ref/master/tree/assets/">assets</a> / <span class="cur">reasons-for-rewriting-in-rust.md</span></nav>
<span class="view-stats"><span>1.3 KiB</span><span>15 lines</span></span><span class="actions"><a class="raw" href="/fork/numbat/raw/93fe596ba815dffb3873cc45cbef37ce646433b2/assets/reasons-for-rewriting-in-rust.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><h2>Reasons why I rewrote Insect in Rust:</h2>
<ul>
<li>Insect is written in PureScript, which is a niche programming language with a (fantastic but) small community. Rust is much more popular amongst developers, so
it is much easier to find contributors in a Rust project than in a PureScript project. This has been an actual problem with Insect, since I got multiple comments
over the years that people wanted to contribute, but couldn't.</li>
<li>A redesign from scratch allowed me to focus on the following areas of improvement:
<ul>
<li>Introducing the concept of physical <em>dimensions</em> into the language (see https://numbat.dev/doc/dimension-definitions.html)</li>
<li>Adding a static type system (see https://numbat.dev/doc/type-system.html)</li>
<li>Allowing users to define their own units (https://numbat.dev/doc/unit-definitions.html)</li>
<li>Being able to define constants and the whole unit system in the language itself (https://numbat.dev/doc/prelude.html)</li>
<li>Much better error messages</li>
<li>Support for notepad-style computations (Mathematica/Jupyter style)</li>
</ul>
</li>
<li>The PureScript implementation is <em>slow</em>. Numbat's Rust-based parser &amp; interpreter is orders of magnitude faster, not just
on the command-line (startup speed!) but also on the Web (via WASM)</li>
<li>I've always wanted to experiment with WASM and Numbat was a perfect excuse for this.</li>
</ul>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text"><a-p>##</a-p> <a-tt>Reasons why I rewrote Insect in Rust:</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text"><a-p>  - </a-p>Insect is written in PureScript, which is a niche programming language with a (fantastic but) small community. Rust is much more popular amongst developers, so</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text"><a-p>    </a-p>it is much easier to find contributors in a Rust project than in a PureScript project. This has been an actual problem with Insect, since I got multiple comments</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text"><a-p>    </a-p>over the years that people wanted to contribute, but couldn&#39;t.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text">  <a-p>- </a-p>A redesign from scratch allowed me to focus on the following areas of improvement:</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text"><a-p>      - </a-p>Introducing the concept of physical *dimensions* into the language (see https://numbat.dev/doc/dimension-definitions.html)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text"><a-p>      - </a-p>Adding a static type system (see https://numbat.dev/doc/type-system.html)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text"><a-p>      - </a-p>Allowing users to define their own units (https://numbat.dev/doc/unit-definitions.html)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text"><a-p>      - </a-p>Being able to define constants and the whole unit system in the language itself (https://numbat.dev/doc/prelude.html)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text"><a-p>      - </a-p>Much better error messages</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text"><a-p>      - </a-p>Support for notepad-style computations (Mathematica/Jupyter style)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text">  <a-p>- </a-p>The PureScript implementation is *slow*. Numbat&#39;s Rust-based parser &amp; interpreter is orders of magnitude faster, not just</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text"><a-p>    </a-p>on the command-line (startup speed!) but also on the Web (via WASM)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text">  <a-p>- </a-p>I&#39;ve always wanted to experiment with WASM and Numbat was a perfect excuse for this.</span></span></pre></div></div>
</main>
</body>
</html>
