diff options
Diffstat (limited to '2023/05/31/OCaml_News_20230531/index.html')
| -rw-r--r-- | 2023/05/31/OCaml_News_20230531/index.html | 274 |
1 files changed, 274 insertions, 0 deletions
diff --git a/2023/05/31/OCaml_News_20230531/index.html b/2023/05/31/OCaml_News_20230531/index.html new file mode 100644 index 00000000..792496fe --- /dev/null +++ b/2023/05/31/OCaml_News_20230531/index.html @@ -0,0 +1,274 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="UTF-8"> +<meta name="viewport" + content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> +<meta http-equiv="X-UA-Compatible" content="ie=edge"> + + <meta name="author" content="含暮秋"> + + + <meta name="subtitle" content="暮秋小屋"> + + + <meta name="description" content="不卑不亢的码农, 朴素的民谣诗人"> + + + <meta name="keywords" content="韩暮秋,MuqiuHan"> + + + + +<title>OCaml News 2023/5/31 | 暮秋小屋</title> + + + + + +<style> + @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&family=Roboto+Mono&display=swap'); +</style> + + + + <!-- stylesheets list from _config.yml --> + + <link rel="stylesheet" href="/css/style.css"> + + + + + + <!-- scripts list from _config.yml --> + + <script src="/js/frame.js"></script> + + + + + + <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> + <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> + + + + + + + + <!-- hexo injector head_end start --> +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"> + +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/style.css"> +<!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.3.0"></head> + <body> + <div class="mask-border"> + </div> + + <div class="wrapper"> + + <div class="header"> + <div class="flex-container"> + <div class="header-inner"> + <div class="site-brand-container"> + <a href="/"> + + 暮秋小屋 + + </a> + </div> + <div id="menu-btn" class="menu-btn" onclick="toggleMenu()"> + Menu + </div> + <nav class="site-nav"> + <ul class="menu-list"> + + + <li class="menu-item"> + <a href="/">主页</a> + </li> + + + + <li class="menu-item"> + <a href="/tags/Technique/">技术</a> + </li> + + + + <li class="menu-item"> + <a href="/Projects">项目</a> + </li> + + + + <li class="menu-item"> + <a href="/categories/gallery/">日记本</a> + </li> + + + + <li class="menu-item"> + <a href="/about">关于</a> + </li> + + + + </ul> + </nav> + </div> + </div> +</div> + + + <div class="main"> + <div class="flex-container"> + <article id="post"> + + + <div class="post-head"> + <div class="post-info"> + <div class="tag-list"> + + + <span class="post-tag"> + <a href="/tags/OCaml/"> + OCaml + </a> + </span> + + <span class="post-tag"> + <a href="/tags/Technique/"> + Technique + </a> + </span> + + + </div> + <div class="post-title"> + + + OCaml News 2023/5/31 + + + </div> + <span class="post-date"> + May 31, 2023 + </span> + </div> + <div class="post-img"> + + <div class="h-line-primary"></div> + + </div> +</div> + <div class="post-content"> + <h1 id="二〇二三年五月二十一-二〇二三年五月三十一日"><a href="#二〇二三年五月二十一-二〇二三年五月三十一日" class="headerlink" title="二〇二三年五月二十一 - 二〇二三年五月三十一日"></a>二〇二三年五月二十一 - 二〇二三年五月三十一日</h1><h2 id="为什么OCaml中总是约定俗成的写-type-t"><a href="#为什么OCaml中总是约定俗成的写-type-t" class="headerlink" title="为什么OCaml中总是约定俗成的写 type t = ... ?"></a>为什么OCaml中总是约定俗成的写 <code>type t = ...</code> ?</h2><p>在OCaml中我们经常会看到:</p> +<figure class="highlight ocaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">module</span> <span class="type">Foo</span> = <span class="keyword">struct</span></span><br><span class="line"> <span class="keyword">type</span> t = ...</span><br><span class="line"> ...</span><br><span class="line"><span class="keyword">end</span></span><br></pre></td></tr></table></figure> +<p>这种写法已经存在于29年前的 <a target="_blank" rel="noopener" href="https://github.com/camllight/camllight/blob/master/sources/src/lib/hashtbl.mli#L5">Caml Light sources</a> 中, SML里面也能看到这种写法。 按照惯例,当一个模块定义了一个唯一的核心抽象数据类型时,就写成<code>type t = ...</code>。</p> +<p>为什么要这么写也有比较多原因,具体可以看论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/why-is-ocaml-convention-to-use-type-t/12256">https://discuss.ocaml.org/t/why-is-ocaml-convention-to-use-type-t/12256</a></p> +<p>但可以知道的是,有了这个约定之后Functor的使用会更加方便。 例如标准库的<code>Set</code>模块,大家都可以直接:</p> +<figure class="highlight ocaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">Set</span>.<span class="type">Make</span>(<span class="type">Foo</span>)</span><br></pre></td></tr></table></figure> + +<p>而不是多写一些无用的代码:</p> +<figure class="highlight ocaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="type">Set</span>.<span class="type">Make</span>(<span class="keyword">struct</span></span><br><span class="line"> <span class="keyword">include</span> <span class="type">Foobar</span></span><br><span class="line"> <span class="keyword">type</span> t = foobar</span><br><span class="line"> <span class="keyword">let</span> compare = compare_foobar </span><br><span class="line"><span class="keyword">end</span>)</span><br><span class="line"></span><br></pre></td></tr></table></figure> + +<h2 id="如何更高效的使用OCaml"><a href="#如何更高效的使用OCaml" class="headerlink" title="如何更高效的使用OCaml"></a>如何更高效的使用OCaml</h2><p>在这个帖子中,针对在OCaml中使用新的库由于因为文档很少并且需要阅读源码导致非常耗时的问题展开了讨论:</p> +<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/how-do-you-stay-productive-in-ocaml/8221">https://discuss.ocaml.org/t/how-do-you-stay-productive-in-ocaml/8221</a></p> +<h2 id="求值顺序"><a href="#求值顺序" class="headerlink" title="求值顺序"></a>求值顺序</h2><p>在OCaml中,想这样的代码:</p> +<figure class="highlight ocaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">foo(f x, f y, f z)</span><br></pre></td></tr></table></figure> +<p>会先对 <code>f z</code> 求值而不是 <code>f x</code>,OCaml官方并没有定义求值顺序,实现上是从右到左的,如果想从左到右只能一个个let。</p> +<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/evaluation-order/12258">https://discuss.ocaml.org/t/evaluation-order/12258</a></p> +<h2 id="OCaml-Platform路线图"><a href="#OCaml-Platform路线图" class="headerlink" title="OCaml Platform路线图"></a>OCaml Platform路线图</h2><p>在2020年的OCaml Platform会议中,avsm和OCaml Platform团队提出了针对开发工具(例如编辑器)的改进,使开发效率提升,这三年以来OCaml的开发工具和开发人员体验发生了很大变化,OCaml Platform的工作也取得了重大进展。</p> +<blockquote> +<p>2020年OCaml Platform会议视频: <a target="_blank" rel="noopener" href="https://watch.ocaml.org/w/2KbfRNv2oLtkKXkbd5u9F1">https://watch.ocaml.org/w/2KbfRNv2oLtkKXkbd5u9F1</a></p> +</blockquote> +<p>对于未来,OCaml Platform打算研究新的OCaml工作流原型。并认为应该反思过去三年所做的一切并制定未来三年的路线图。</p> +<p>所以在过去的几个月里,OCaml Platform一直致力于收集尽可能多的社区反馈,并组织了几个会议,会见了使用OCaml的来自各个行业的开发者,并从他们口中了解相关的需求和痛点。在会议中还共同思考了理想的 OCaml 开发人员体验应该是什么。</p> +<p>OCaml Platform希望由社区驱动自身,所以公布了路线图,并开始收集反馈并对其进行更新迭代:</p> +<blockquote> +<p>OCaml Platfrom路线图: <a target="_blank" rel="noopener" href="https://github.com/tarides/ocaml-platform-roadmap">https://github.com/tarides/ocaml-platform-roadmap</a></p> +</blockquote> +<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/a-roadmap-for-the-ocaml-platform-seeking-your-feedback/12238">https://discuss.ocaml.org/t/a-roadmap-for-the-ocaml-platform-seeking-your-feedback/12238</a></p> +<h2 id="OCaml的Debug体验"><a href="#OCaml的Debug体验" class="headerlink" title="OCaml的Debug体验"></a>OCaml的Debug体验</h2><p>VS Code唯一的debug支持是 <a target="_blank" rel="noopener" href="https://github.com/hackwaly/ocamlearlybird/">hackwaly/ocamlearlybird</a> , 但遗憾的是它已经不积极维护了(根据 README 判断它只支持 4.11 和 4.12)。</p> +<p>所以在出现更好的替代方案之前…</p> +<blockquote> +<p>The most effective debugging tool is still careful thought, coupled with judiciously placed print statements!!!</p> +</blockquote> +<p>不过除此之外还是有很多Debug相关的库和方案的,比如上一期的 <a target="_blank" rel="noopener" href="https://github.com/lukstafi/ppx_minidebug">ppx_minidebug</a> 和 <a target="_blank" rel="noopener" href="https://github.com/dariusf/ppx_debug">ppx_debug</a> 或者是 <a target="_blank" rel="noopener" href="https://github.com/dariusf/ppx_interact">ppx_interact</a>。</p> +<p>具体的可以看论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/enhancing-ocaml-debugging-experience-in-visual-studio-code/12236">https://discuss.ocaml.org/t/enhancing-ocaml-debugging-experience-in-visual-studio-code/12236</a></p> +<h2 id="类似-MIT-Scratch-x2F-Berkeley-Snap-x2F-Google-Blockly-之类的OCaml实现?"><a href="#类似-MIT-Scratch-x2F-Berkeley-Snap-x2F-Google-Blockly-之类的OCaml实现?" class="headerlink" title="类似 MIT Scratch/Berkeley Snap/Google Blockly 之类的OCaml实现?"></a>类似 MIT Scratch/Berkeley Snap/Google Blockly 之类的OCaml实现?</h2><p><a target="_blank" rel="noopener" href="https://github.com/google/blockly">Blockly</a>是一个基于网络的可视化编程编辑器。</p> +<p>OCaml中也有类似的 <a target="_blank" rel="noopener" href="https://hazel.org/">Hazle</a></p> +<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/exists-scratch-snap-blockly-for-ocaml-js/12234">https://discuss.ocaml.org/t/exists-scratch-snap-blockly-for-ocaml-js/12234</a></p> +<h2 id="Tiny-httpd-v0-13"><a href="#Tiny-httpd-v0-13" class="headerlink" title="Tiny_httpd v0.13"></a>Tiny_httpd v0.13</h2><p><a target="_blank" rel="noopener" href="https://github.com/c-cube/tiny_httpd">Tiny_httpd</a> 是一个极简的 HTTP 1.1 服务器库,它依赖线程(或线程池)而不是异步/协作多任务处理。可能有点异端。</p> +<h2 id="Parany-v14-0-0"><a href="#Parany-v14-0-0" class="headerlink" title="Parany v14.0.0"></a>Parany v14.0.0</h2><p><a target="_blank" rel="noopener" href="https://github.com/UnixJunkie/parany">Parany</a>可以用于并行化任何类型的计算,在这个版本中作者将运行时切换回了<code>fork+marshal</code></p> +<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/new-major-release-of-parany-v14-0-0/12208">https://discuss.ocaml.org/t/new-major-release-of-parany-v14-0-0/12208</a></p> +<h2 id="Merlin-v4-9"><a href="#Merlin-v4-9" class="headerlink" title="Merlin v4.9"></a>Merlin v4.9</h2><p><a target="_blank" rel="noopener" href="https://github.com/ocaml/merlin">Merlin</a> 是为OCaml提供现代IDE功能的编辑器后端服务,这个新版本带来了许多改进和错误修复。而且发现并修复了一个重要的内存消耗问题.</p> +<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/ann-new-release-merlin-4-9/12277">https://discuss.ocaml.org/t/ann-new-release-merlin-4-9/12277</a></p> +<h2 id="OCaml-Learn板块更新"><a href="#OCaml-Learn板块更新" class="headerlink" title="OCaml Learn板块更新"></a>OCaml Learn板块更新</h2><p>社区成员为官网的<a target="_blank" rel="noopener" href="https://staging.ocaml.org/docs">Learn板块</a>贡献了以章有关<a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/creating-a-tutorial-on-sequences/12091">Sequence</a>的教程。</p> +<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/creating-a-tutorial-on-sequences/12091">https://discuss.ocaml.org/t/creating-a-tutorial-on-sequences/12091</a></p> +<h2 id="生态"><a href="#生态" class="headerlink" title="生态"></a>生态</h2><ul> +<li><a target="_blank" rel="noopener" href="https://github.com/janestreet/streamable">streamable</a>: A collection of types suitable for incremental serialization. </li> +<li><a target="_blank" rel="noopener" href="https://github.com/janestreet/incr_dom">incr_dom</a>: A library for building dynamic webapps, using Js_of_ocaml.</li> +</ul> + +</div> + +<script> + window.onload = detectors(); +</script> + <div class="post-footer"> + <div class="h-line-primary"></div> + <nav class="post-nav"> + <div class="prev-item"> + + </div> + <div class="next-item"> + + <div class="icon arrow-right"></div> + <div class="post-link"> + <a href="/2023/05/21/OCaml_News_20230521/">Next</a> + </div> + + </div> + </nav> +</div> + + + <div class="post-comment"> + + + + + + + +</div> + + +</article> + </div> + </div> + + <div class="footer"> + <div class="flex-container"> + <div class="footer-text"> + + + | + + + 希望路过的人可以添点柴火让这里暖和点 + + </div> + </div> +</div> + + </div> + + + + + </body> +</html> |
