summaryrefslogtreecommitdiff
path: root/2023/05/15/OCaml_News_20230515/index.html
blob: e5284b8e69573c08099ee8f317d5881426b01565 (plain)
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<!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/15 | 暮秋小屋</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/15
            
            
        </div>
        <span class="post-date">
            May 15, 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最新的并行特性相关文档"><a href="#关于OCaml最新的并行特性相关文档" class="headerlink" title="关于OCaml最新的并行特性相关文档"></a>关于OCaml最新的并行特性相关文档</h2><ol>
<li>Eio的README有很多例子: <a target="_blank" rel="noopener" href="https://github.com/ocaml-multicore/eio">https://github.com/ocaml-multicore/eio</a></li>
<li>ocaml-multicore组织官方的教程仓库: <a target="_blank" rel="noopener" href="https://github.com/ocaml-multicore/parallel-programming-in-multicore-ocaml">https://github.com/ocaml-multicore/parallel-programming-in-multicore-ocaml</a></li>
<li>OCaml的Manual: <a target="_blank" rel="noopener" href="https://v2.ocaml.org/releases/5.0/htmlman/parallelism.html">https://v2.ocaml.org/releases/5.0/htmlman/parallelism.html</a></li>
</ol>
<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/new-concurrency-features/12158">https://discuss.ocaml.org/t/new-concurrency-features/12158</a></p>
<h2 id="使用OCaml通过串口与STM32通信"><a href="#使用OCaml通过串口与STM32通信" class="headerlink" title="使用OCaml通过串口与STM32通信"></a>使用OCaml通过串口与STM32通信</h2><p>在Linux&#x2F;Unix上可以:</p>
<ul>
<li>适用于linux&#x2F;unix的oserial: <a target="_blank" rel="noopener" href="https://github.com/m-laniakea/oserial">https://github.com/m-laniakea/oserial</a></li>
<li>直接打开 <code>/dev/XXX</code> 文件用Unix模块相关的API与其交互, 一个例子: <a target="_blank" rel="noopener" href="https://gist.github.com/dbuenzli/035bc5c8598069360dd7301f55e7774a">https://gist.github.com/dbuenzli/035bc5c8598069360dd7301f55e7774a</a></li>
</ul>
<p>Windows目前没有解决方案。</p>
<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/is-there-any-library-of-ocaml-to-use-serial-port-of-pc/3658">https://discuss.ocaml.org/t/is-there-any-library-of-ocaml-to-use-serial-port-of-pc/3658</a></p>
<h2 id="使用OCaml构建IOS-APP"><a href="#使用OCaml构建IOS-APP" class="headerlink" title="使用OCaml构建IOS APP"></a>使用OCaml构建IOS APP</h2><ul>
<li>通过Js_of_ocaml编译为JavaScript并使用像CapacitorJS(甚至是旧的Cordova)这样的框架或许是一条路子。</li>
<li><a target="_blank" rel="noopener" href="http://psellos.com/aboutus.html">Psellos</a>是一个注重现代函数式语言(OCaml, F#, Haskell)的组织,它们维护了一个将OCaml编译到IOS的交叉编译器: <a target="_blank" rel="noopener" href="http://psellos.com/ocaml/compile-to-iphone.html">http://psellos.com/ocaml/compile-to-iphone.html</a></li>
<li>ocaml-cocoa的demo: <a target="_blank" rel="noopener" href="https://github.com/dboris/ocaml-cocoa/blob/master/examples/count_clicks.ml">https://github.com/dboris/ocaml-cocoa/blob/master/examples/count_clicks.ml</a></li>
</ul>
<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/building-ios-apps-with-ocaml/12153">https://discuss.ocaml.org/t/building-ios-apps-with-ocaml/12153</a></p>
<h2 id="Ahref现在使用Melange构建"><a href="#Ahref现在使用Melange构建" class="headerlink" title="Ahref现在使用Melange构建"></a>Ahref现在使用Melange构建</h2><p><a href="">Melange</a>是结合使用 OCaml 和 Reason 生成 JavaScript 的工具组合。<br><a target="_blank" rel="noopener" href="https://ahrefs.com/">Ahrefs</a>是一个SEO软件套装,包含外链建设、关键字研究、竞争对手分析,排名跟踪和站点审核等工具。Ahrefs内部的大多数功能都是为营销专业人员设计的。</p>
<p>自去年 9 月以来,Melange、Dune 和 Ahrefs 开发团队一直致力于加强 Dune 和 Melange 之间的集成。作为一家在后端使用大量 OCaml 的公司,Ahrefs看到了Melange可以将其前端技术栈与OCaml更紧密结合(通过使用Melange与UI相关的JavaScript生态系统集成)。因此,该公司决定投资并积极参与以实现这种整合。</p>
<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/ahrefs-is-now-built-with-melange/12107">https://discuss.ocaml.org/t/ahrefs-is-now-built-with-melange/12107</a></p>
<h2 id="Ahref正在招聘OCaml开发人员"><a href="#Ahref正在招聘OCaml开发人员" class="headerlink" title="Ahref正在招聘OCaml开发人员"></a>Ahref正在招聘OCaml开发人员</h2><p>一如既往,Ahrefs正在寻找OCaml开发人员,他们总部位于新加坡,团队遍布各地,所以也支持远程,详见:<br><a target="_blank" rel="noopener" href="https://ahrefs.com/jobs/ocaml-developer">https://ahrefs.com/jobs/ocaml-developer</a></p>
<p>论坛原帖: <a target="_blank" rel="noopener" href="https://discuss.ocaml.org/t/ahrefs-is-hiring/12136">https://discuss.ocaml.org/t/ahrefs-is-hiring/12136</a></p>
<h2 id="string-literals-inside-comments-5745"><a href="#string-literals-inside-comments-5745" class="headerlink" title="string literals inside comments #5745"></a>string literals inside comments #5745</h2><p>草,OCaml的parser不会忽略注释中的引号:</p>
<figure class="highlight plaintext"><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><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">$ echo &#x27;(* &quot;test *)&#x27; | ocaml </span><br><span class="line">OCaml version 5.0.0</span><br><span class="line">Enter #help;; for help.</span><br><span class="line"></span><br><span class="line"># (* &quot;test *)tive `utop_prompt_fancy_light&#x27;.</span><br><span class="line"># * </span><br><span class="line">Error: This comment contains an unterminated string literal</span><br><span class="line">Line 1, characters 3-4:   String literal begins here</span><br><span class="line"># </span><br></pre></td></tr></table></figure>

<p>而经过讨论认为修复这个问题是向后不兼容的,所以修复这个词法分析器错误的风险似乎大于好处,就给close了。</p>
<p>相关issue: <a target="_blank" rel="noopener" href="https://github.com/ocaml/ocaml/issues/5745">https://github.com/ocaml/ocaml/issues/5745</a></p>
<p>有趣的是F#也继承了这个问题:</p>
<figure class="highlight plaintext"><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><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">$ echo &#x27;(* &quot;test *)&#x27; | dotnet fsi</span><br><span class="line"></span><br><span class="line">Microsoft (R) F# Interactive version 12.5.0.0 for F# 7.0</span><br><span class="line">Copyright (c) Microsoft Corporation. All Rights Reserved.</span><br><span class="line"></span><br><span class="line">For help type #help;;</span><br><span class="line"></span><br><span class="line">&gt; </span><br><span class="line">  (* &quot;test *)</span><br><span class="line">  ^^</span><br><span class="line"></span><br><span class="line">/home/muqiu-han/stdin(1,1): error FS0517: End of file in string embedded in comment begun at or before here</span><br></pre></td></tr></table></figure>


</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/09/OCaml_News_20230509/">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>