<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://50.77.162.165/mediawiki/skins/common/feed.css?207"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Miranda order - Revision history</title>
		<link>http://50.77.162.165/mediawiki/index.php?title=Miranda_order&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.5-7</generator>
		<lastBuildDate>Sat, 02 May 2026 20:53:10 GMT</lastBuildDate>
		<item>
			<title>Kevin Reid:&amp;#32;let's have an explicit verb type</title>
			<link>http://50.77.162.165/mediawiki/index.php?title=Miranda_order&amp;diff=2157&amp;oldid=prev</link>
			<guid>http://50.77.162.165/mediawiki/index.php?title=Miranda_order&amp;diff=2157&amp;oldid=prev</guid>
			<description>&lt;p&gt;let&amp;#39;s have an explicit verb type&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{instance msgdoc|__order|2|&amp;lt;var&amp;gt;verb&amp;lt;/var&amp;gt; :[[Verb]], &amp;lt;var&amp;gt;args&amp;lt;/var&amp;gt; :[[List]]|[[any]]}}&lt;br /&gt;
&lt;br /&gt;
'''__order/2''' is a [[Miranda message]] for sending messages contingent on an earlier success.&lt;br /&gt;
&lt;br /&gt;
This method does the equivalent of&lt;br /&gt;
&lt;br /&gt;
    to __order(verb, args) :any {&lt;br /&gt;
        [E.call(self, verb, args), self]&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
In other words, it calls the receiving object with the message&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;var&amp;gt;verb&amp;lt;/var&amp;gt;(&amp;lt;var&amp;gt;args...&amp;lt;/var&amp;gt;)&amp;lt;/code&amp;gt;, and, if successful, returns a pair&lt;br /&gt;
of the result of this call and the receiving object itself.&lt;br /&gt;
&lt;br /&gt;
What is this for?  Consider the client code fragment&lt;br /&gt;
&lt;br /&gt;
     databaseRcvr &amp;lt;- put(key1, value1)&lt;br /&gt;
     def value2Vow := databaseRcvr &amp;lt;- get(key2)&lt;br /&gt;
E's [http://www.erights.org/elib/concurrency/partial-order.html partial ordering semantics]&lt;br /&gt;
ensure that put will be delivered before&lt;br /&gt;
get is delivered. That is often good enough. But it is a weaker&lt;br /&gt;
guarantee than that provided by the following sequential code&lt;br /&gt;
&lt;br /&gt;
     database put(key1, value1)&lt;br /&gt;
     def value2Vow := database get(key2)&lt;br /&gt;
&lt;br /&gt;
In this code, not only will get only happen after put is delivered, get&lt;br /&gt;
will only happen after put ''succeeds''. If put instead throws an&lt;br /&gt;
exception, the get will never happen. Often we want this effect. How can&lt;br /&gt;
we achieve this with eventual-sends to eventual references?&lt;br /&gt;
&lt;br /&gt;
When one wants to take an action contingent on the results of a previous&lt;br /&gt;
action, the conventional E answer is to use a when-catch-finally&lt;br /&gt;
expression&lt;br /&gt;
&lt;br /&gt;
    def ackVow := databaseRcvr &amp;lt;- put(key1, value1)&lt;br /&gt;
    def value2Vow := when (ackVow) -&amp;gt; {&lt;br /&gt;
        databaseRcvr &amp;lt;- get(key2)&lt;br /&gt;
    } catch problem {&lt;br /&gt;
        throw(problem)&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
This is fine, as is probably the solution to be used by default for this&lt;br /&gt;
situation. However, it does force a round-trip between the get and put,&lt;br /&gt;
and so loses the benefits of pipelining. Using the __order message, we&lt;br /&gt;
can get contingent execution + pipelining, at some cost in obscurity.&lt;br /&gt;
(Note: often, the cost of obscurity will dominate.)&lt;br /&gt;
&lt;br /&gt;
    def pairVow := databaseRcvr &amp;lt;- __order(&amp;quot;put&amp;quot;, [key1, value1])&lt;br /&gt;
    # If put's return value were interesting, we'd 'pairVow &amp;lt;- get(0)'&lt;br /&gt;
    def newDBRcvr := pairVow &amp;lt;- get(1)&lt;br /&gt;
    def value2Vow := newDBRcvr &amp;lt;- get(key2)&lt;br /&gt;
&lt;br /&gt;
If put throws, then &amp;lt;var&amp;gt;pairVow&amp;lt;/var&amp;gt; will resolve directly to broken, so newDB&lt;br /&gt;
will likewise resolve to broken, as will &amp;lt;var&amp;gt;value2Vow&amp;lt;/var&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===Distinguishing unresolved response from unresolved value===&lt;br /&gt;
&lt;br /&gt;
It is also possible to use __order to observe when the turn caused by an eventual send finishes, even if its return value is itself an unresolved promise, by waiting for the returned tuple, or its second element, to resolve.&lt;br /&gt;
&lt;br /&gt;
[[Category:Miranda messages]]&lt;br /&gt;
[[Category:Pluribus]]&lt;/div&gt;</description>
			<pubDate>Sun, 07 Aug 2011 03:52:42 GMT</pubDate>			<dc:creator>Kevin Reid</dc:creator>			<comments>http://50.77.162.165/wiki/Talk:Miranda_order</comments>		</item>
		<item>
			<title>Kevin Reid:&amp;#32;Distinguishing unresolved response from unresolved value</title>
			<link>http://50.77.162.165/mediawiki/index.php?title=Miranda_order&amp;diff=4487&amp;oldid=prev</link>
			<guid>http://50.77.162.165/mediawiki/index.php?title=Miranda_order&amp;diff=4487&amp;oldid=prev</guid>
			<description>&lt;p&gt;Distinguishing unresolved response from unresolved value&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 04:17, 1 August 2011&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If put throws, then &amp;lt;var&amp;gt;pairVow&amp;lt;/var&amp;gt; will resolve directly to broken, so newDB&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If put throws, then &amp;lt;var&amp;gt;pairVow&amp;lt;/var&amp;gt; will resolve directly to broken, so newDB&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;will likewise resolve to broken, as will &amp;lt;var&amp;gt;value2Vow&amp;lt;/var&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;will likewise resolve to broken, as will &amp;lt;var&amp;gt;value2Vow&amp;lt;/var&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;===Distinguishing unresolved response from unresolved value===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;It is also possible to use __order to observe when the turn caused by an eventual send finishes, even if its return value is itself an unresolved promise, by waiting for the returned tuple, or its second element, to resolve.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Miranda messages]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Miranda messages]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Pluribus]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Pluribus]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-05-02 20:53:11 --&gt;
&lt;/table&gt;</description>
			<pubDate>Mon, 01 Aug 2011 04:17:48 GMT</pubDate>			<dc:creator>Kevin Reid</dc:creator>			<comments>http://50.77.162.165/wiki/Talk:Miranda_order</comments>		</item>
		<item>
			<title>Kevin Reid:&amp;#32;Documentation from MirandaMethods.java (licensed by MarkM's stated blanket permission)</title>
			<link>http://50.77.162.165/mediawiki/index.php?title=Miranda_order&amp;diff=4486&amp;oldid=prev</link>
			<guid>http://50.77.162.165/mediawiki/index.php?title=Miranda_order&amp;diff=4486&amp;oldid=prev</guid>
			<description>&lt;p&gt;Documentation from MirandaMethods.java (licensed by MarkM&amp;#39;s stated blanket permission)&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 03:59, 1 August 2011&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{instance msgdoc|__order|2|&amp;lt;var&amp;gt;verb&amp;lt;/var&amp;gt; :[[&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Verb&lt;/del&gt;]], &amp;lt;var&amp;gt;args&amp;lt;/var&amp;gt; :[[List]]|[[any]]}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{instance msgdoc|__order|2|&amp;lt;var&amp;gt;verb&amp;lt;/var&amp;gt; :[[&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;String&lt;/ins&gt;]], &amp;lt;var&amp;gt;args&amp;lt;/var&amp;gt; :[[List]]|[[any]]}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''__order/2''' is a [[Miranda message]] for sending messages contingent on an earlier success.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;'''__order/2''' is a [[Miranda message]] for sending messages contingent on an earlier success.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If put throws, then &amp;lt;var&amp;gt;pairVow&amp;lt;/var&amp;gt; will resolve directly to broken, so newDB&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If put throws, then &amp;lt;var&amp;gt;pairVow&amp;lt;/var&amp;gt; will resolve directly to broken, so newDB&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;will likewise resolve to broken, as will &amp;lt;var&amp;gt;value2Vow&amp;lt;/var&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;will likewise resolve to broken, as will &amp;lt;var&amp;gt;value2Vow&amp;lt;/var&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;===Distinguishing unresolved response from unresolved value===&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;It is also possible to use __order to observe when the turn caused by an eventual send finishes, even if its return value is itself an unresolved promise, by waiting for the returned tuple, or its second element, to resolve.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Miranda messages]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Miranda messages]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Pluribus]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Pluribus]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-05-02 20:53:11 --&gt;
&lt;/table&gt;</description>
			<pubDate>Mon, 01 Aug 2011 03:59:23 GMT</pubDate>			<dc:creator>Kevin Reid</dc:creator>			<comments>http://50.77.162.165/wiki/Talk:Miranda_order</comments>		</item>
	</channel>
</rss>