<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=Concurrent_ML</id>
	<title>Concurrent ML - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=Concurrent_ML"/>
	<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=Concurrent_ML&amp;action=history"/>
	<updated>2026-06-28T20:58:36Z</updated>
	<subtitle>在这个wiki上该页的修订历史</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://arolstar52-zhtest.hf.space/index.php?title=Concurrent_ML&amp;diff=3676028&amp;oldid=prev</id>
		<title>imported&gt;ExultantEditor 来自 2025年12月26日 (五) 18:03</title>
		<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=Concurrent_ML&amp;diff=3676028&amp;oldid=prev"/>
		<updated>2025-12-26T18:03:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Infobox programming language&lt;br /&gt;
| name = Concurrent ML&lt;br /&gt;
| logo = &lt;br /&gt;
| paradigm = [[并发计算]]&lt;br /&gt;
| family = [[ML语言|ML]]&lt;br /&gt;
| year = {{Start date and age|1991|df=yes}}&amp;lt;ref name=&amp;quot;pldi91&amp;quot;&amp;gt;{{cite conference|title=CML: a Higher-Order Concurrent Language|conference=PLDI|date=June 1991|last=Reppy|first=John H.}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| designer = John Reppy&lt;br /&gt;
| latest release version =&lt;br /&gt;
| latest release date =&lt;br /&gt;
| typing =&lt;br /&gt;
| implementations = [[新泽西Standard ML|SML/NJ]]&amp;lt;ref&amp;gt;{{cite web|url=https://www.smlnj.org/smlnj.html|title=What is Standard ML of New Jersey?|access-date=April 5, 2021|archive-date=2021-04-20|archive-url=https://web.archive.org/web/20210420014850/https://www.smlnj.org/smlnj.html}}&amp;lt;/ref&amp;gt;，[[MLton]]&amp;lt;ref&amp;gt;{{cite web|url=http://mlton.org/ConcurrentMLImplementation|access-date=April 5, 2021|title=ConcurrentMLImplementation|archive-date=2021-05-16|archive-url=https://web.archive.org/web/20210516040737/http://mlton.org/ConcurrentMLImplementation}}&amp;lt;/ref&amp;gt;， Manticore&amp;lt;ref name=&amp;quot;manticore&amp;quot;/&amp;gt;&lt;br /&gt;
| dialects =&lt;br /&gt;
| influenced_by =&lt;br /&gt;
| influenced =&lt;br /&gt;
| file_ext =&lt;br /&gt;
| website = {{URL|http://cml.cs.uchicago.edu/}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Concurrent ML&amp;#039;&amp;#039;&amp;#039;（CML）是[[Standard ML]][[编程语言]]的[[并发计算|并发]]扩展，其特征是能够允许编程者建立{{le|函数复合 (计算机科学)|Function composition (computer science)|可复合}}的通信[[抽象化 (计算机科学)|抽象]]，它是为[[头等对象]]而并未建入于语言。CML的设计和原语操作已经被一些其他编程语言接纳，比如[[GNU Guile]]&amp;lt;ref&amp;gt;{{cite web|url=https://wingolog.org/archives/2017/06/29/a-new-concurrent-ml|title=A New Concurrent ML|date=June 29, 2017|accessdate=July 11, 2018|first=Andy|last=Wingo|archive-date=2020-12-06|archive-url=https://web.archive.org/web/20201206011323/https://wingolog.org/archives/2017/06/29/a-new-concurrent-ml}}&amp;lt;/ref&amp;gt;、[[Racket]]&amp;lt;ref&amp;gt;{{cite journal|last1=Flatt|first1=Matthew|last2=Findler|first2=Robert Bruce|date=2004|title=Kill-safe synchronization abstractions|journal=Proceedings of the ACM SIGPLAN 2004 Conference on Programming Language Design and Implementation|volume=39|issue=6|pages=47–58|doi=10.1145/996841.996849}}&amp;lt;/ref&amp;gt;和Manticore&amp;lt;ref name=&amp;quot;manticore&amp;quot;&amp;gt;{{cite web|url=http://manticore.cs.uchicago.edu/papers/cefp09-notes.pdf|title=Programming in Manticore, a Heterogenous Parallel Functional Language|last1=Fluet|first1=Matthew|last2=Bergstrom|first2=Lars|last3=Ford|first3=Nic|last4=Rainey|first4=Mike|last5=Reppy|first5=John|last6=Shaw|first6=Adam|last7=Xiao|first7=Yingqi|date=May 2009|accessdate=July 11, 2018|archive-date=2021-05-16|archive-url=https://web.archive.org/web/20210516040737/http://manticore.cs.uchicago.edu/papers/cefp09-notes.pdf}}&amp;lt;/ref&amp;gt;。&lt;br /&gt;
&lt;br /&gt;
==概念==&lt;br /&gt;
&lt;br /&gt;
很多支持[[并发性]]的编程语言提供在并发[[通道 (编程)|通信通道]]，来允许在并发运行于系统中的[[进程]]或[[线程]]之间的值交换。在进程之间建立的通信服从特定的协议，要求编程者书写函数来建立通信所要求的模式。同时，通信系统经常需要建立多个通道，比如多个[[服务器]]，并接着在有新数据可获得的时候，在可获得的通道之间进行选择。这可以使用[[轮询]]完成，比如Unix系统上的&amp;lt;code&amp;gt;[[select (Unix)|select]]&amp;lt;/code&amp;gt;操作。&lt;br /&gt;
&lt;br /&gt;
组合特定于应用的协议和多方通信二者可能是复杂的，因为需要在预先存在的协议内介入轮询和检查[[阻塞 (计算)|阻塞]]。Concurrent ML通过介入可同步的[[事件 (同步原语)|事件]]，简约了这种编程概念的[[耦合性 (计算机科学)|耦合]]&amp;lt;ref name=&amp;quot;cml-paper&amp;quot;&amp;gt;{{cite book|journal=Functional Programming, Concurrency, Simulation and Automated Reasoning|volume=693|pages=165–198|first=John H.|last=Reppy|title=Concurrent ML: Design, application and semantics|date=1993|doi=10.1007/3-540-56883-2_10|series=Lecture Notes in Computer Science|isbn=978-3-540-56883-4}}&amp;lt;/ref&amp;gt;。事件是可用于[[同步]]操作（在CML和Racket中叫做&amp;lt;code&amp;gt;sync&amp;lt;/code&amp;gt;）的头等抽象，用于潜在的阻塞并接着产生来自通信（例如在通道上的数据传输）结果的一些值。&lt;br /&gt;
&lt;br /&gt;
在CML中，事件可以使用一些原语（primitive）操作来组合或操纵。每个原语操作构造一个新事件而非就地修改事件，允许构造表示想要的通信模式的复合事件。例如，CML允许编程者组合一些子事件来创建复合事件，它可以非确定性的选择其中某一个子事件。另一个原语操作建立新事件，它会修改来自在最初事件上的同步的结果值。这些事件具体化了通信模式，在非CML语言中要使用轮询循环或函数通过给每类事件的处理器来处理。&lt;br /&gt;
&lt;br /&gt;
==样例代码==&lt;br /&gt;
下面是打印“[[hello, world]]”至控制台的样例代码。它产生一个[[线程]]来为[[字符串]]创建一个通道。这个线程接着产生另一个线程，来打印在这个通道上接收的第一个字符串。前者线程接着在这个通道上发送&amp;lt;code&amp;gt;&amp;quot;hello, world\n&amp;quot;&amp;lt;/code&amp;gt;字符串。它使用了[[新泽西Standard ML|SML/NJ]]和CML：&lt;br /&gt;
&lt;br /&gt;
;cml_test.cm：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pascal&amp;quot;&amp;gt;&lt;br /&gt;
Library&lt;br /&gt;
    structure Hello&lt;br /&gt;
is&lt;br /&gt;
    $cml/basis.cm&lt;br /&gt;
    $cml/cml.cm&lt;br /&gt;
    cml_test.sml&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
;cml_test.sml：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sml&amp;quot;&amp;gt;&lt;br /&gt;
structure Hello =&lt;br /&gt;
struct&lt;br /&gt;
    open CML&lt;br /&gt;
        &lt;br /&gt;
    fun hello () =&lt;br /&gt;
        let val c : string chan = channel ()&lt;br /&gt;
        in&lt;br /&gt;
            spawn (fn () =&amp;gt; TextIO.print (recv c));&lt;br /&gt;
            send (c, &amp;quot;hello, world\n&amp;quot;);&lt;br /&gt;
            exit ()&lt;br /&gt;
        end&lt;br /&gt;
            &lt;br /&gt;
    fun main (name, argv) =&lt;br /&gt;
        RunCML.doit (fn () =&amp;gt; ignore (spawn hello), NONE)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
;运行：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;console&amp;quot;&amp;gt;&lt;br /&gt;
$ ml-build cml_test.cm Hello.main&lt;br /&gt;
Standard ML of New Jersey v110.79 [built: Mon Apr 22 10:14:55 2024]&lt;br /&gt;
[scanning cml_test.cm]&lt;br /&gt;
[library $cml/basis.cm is stable]&lt;br /&gt;
[library $cml/cml.cm is stable]&lt;br /&gt;
[parsing (cml_test.cm):cml_test.sml]&lt;br /&gt;
[creating directory .cm/SKEL]&lt;br /&gt;
[library $cml/cml-internal.cm is stable]&lt;br /&gt;
[library $cml/core-cml.cm is stable]&lt;br /&gt;
[library $SMLNJ-BASIS/basis.cm is stable]&lt;br /&gt;
[library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable]&lt;br /&gt;
[compiling (cml_test.cm):cml_test.sml]&lt;br /&gt;
[creating directory .cm/GUID]&lt;br /&gt;
[creating directory .cm/x86-unix]&lt;br /&gt;
[code: 2738, data: 42, env: 2507 bytes]&lt;br /&gt;
[scanning 17180-export.cm]&lt;br /&gt;
[scanning (17180-export.cm):cml_test.cm]&lt;br /&gt;
[parsing (17180-export.cm):17180-export.sml]&lt;br /&gt;
[compiling (17180-export.cm):17180-export.sml]&lt;br /&gt;
[code: 317, data: 37, env: 40 bytes]&lt;br /&gt;
$ sml @SMLload=cml_test.x86-linux&lt;br /&gt;
hello, world&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
注意在非linux-x86平台上堆名字可能不同，若此则需要将有&amp;lt;code&amp;gt;cml_test.x86-linux&amp;lt;/code&amp;gt;的行变更为对应的变体。在[[Ubuntu]]系统下，CML的安装包是&amp;lt;code&amp;gt;libcml-smlnj&amp;lt;/code&amp;gt;。&lt;br /&gt;
&lt;br /&gt;
==引用==&lt;br /&gt;
{{reflist|2}}&lt;br /&gt;
&lt;br /&gt;
==外部链接==&lt;br /&gt;
{{Official website|http://cml.cs.uchicago.edu/}}&lt;br /&gt;
&lt;br /&gt;
[[Category:程序架构]]&lt;br /&gt;
[[Category:并发编程语言]]&lt;br /&gt;
[[Category:ML语言家族]]&lt;br /&gt;
[[Category:1991年建立的程式語言]]&lt;/div&gt;</summary>
		<author><name>imported&gt;ExultantEditor</name></author>
	</entry>
</feed>