miller/docs6/docs/_build/html/reference-dsl-complexity.html

55 lines
No EOL
4.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DSL reference: a note on the complexity of Millers expression language &#8212; Miller 6.0.0-alpha documentation</title>
<link rel="stylesheet" href="_static/scrolls.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/print.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<script src="_static/theme_extras.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Manpage" href="manpage.html" />
<link rel="prev" title="DSL reference: errors and transparency" href="reference-dsl-errors.html" />
</head><body>
<div id="content">
<div class="header">
<h1 class="heading"><a href="index.html"
title="back to the documentation overview"><span>DSL reference: a note on the complexity of Millers expression language</span></a></h1>
</div>
<div class="relnav" role="navigation" aria-label="related navigation">
<a href="reference-dsl-errors.html">&laquo; DSL reference: errors and transparency</a> |
<a href="#">DSL reference: a note on the complexity of Millers expression language</a>
| <a href="manpage.html">Manpage &raquo;</a>
</div>
<div id="contentwrapper">
<div role="main">
<div class="section" id="dsl-reference-a-note-on-the-complexity-of-miller-s-expression-language">
<h1>DSL reference: a note on the complexity of Millers expression language<a class="headerlink" href="#dsl-reference-a-note-on-the-complexity-of-miller-s-expression-language" title="Permalink to this headline"></a></h1>
<p>One of Millers strengths is its brevity: its much quicker and less error-prone to type <code class="docutils literal notranslate"><span class="pre">mlr</span> <span class="pre">stats1</span> <span class="pre">-a</span> <span class="pre">sum</span> <span class="pre">-f</span> <span class="pre">x,y</span> <span class="pre">-g</span> <span class="pre">a,b</span></code> than having to track summation variables as in <code class="docutils literal notranslate"><span class="pre">awk</span></code>, or using Millers out-of-stream variables. And the more language features Millers put-DSL has (for-loops, if-statements, nested control structures, user-defined functions, etc.) then the <em>less</em> powerful it begins to seem: because of the other programming-language features it <em>doesnt</em> have (classes, exceptions, and so on).</p>
<p>When I was originally prototyping Miller in 2015, the decision I had was whether to hand-code in a low-level language like C or Rust or Go, with my own hand-rolled DSL, or whether to use a higher-level language (like Python or Lua or Nim) and let the <code class="docutils literal notranslate"><span class="pre">put</span></code> statements be handled by the implementation languages own <code class="docutils literal notranslate"><span class="pre">eval</span></code>: the implementation language would take the place of a DSL. Multiple performance experiments showed me I could get better throughput using the former, by a wide margin. So Miller is Go under the hood with a hand-rolled DSL.</p>
<p>I do want to keep focusing on what Miller is good at concise notation, low latency, and high throughput and not add too much in terms of high-level-language features to the DSL. That said, some sort of customizability is a basic thing to want. As of 4.1.0 we have recursive for/while/if structures on about the same complexity level as <code class="docutils literal notranslate"><span class="pre">awk</span></code>; as of 5.0.0 we have user-defined functions and map-valued variables, again on about the same complexity level as <code class="docutils literal notranslate"><span class="pre">awk</span></code> along with optional type-declaration syntax; as of Miller 6 we have full support for arrays. While Im excited by these powerful language features, I hope to keep new features focused on Millers sweet spot which is speed plus simplicity.</p>
</div>
</div>
</div>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2021, John Kerl.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
</div>
</body>
</html>