<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mitcho.com &#187; asynchronous</title>
	<atom:link href="http://mitcho.com/blog/tag/asynchronous/feed/" rel="self" type="application/rss+xml" />
	<link>http://mitcho.com</link>
	<description></description>
	<lastBuildDate>Sat, 11 Feb 2012 12:23:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
		<item>
		<title>Exploring Command Chaining in Ubiquity: Part 1</title>
		<link>http://mitcho.com/blog/projects/exploring-command-chaining-in-ubiquity-part-1/</link>
		<comments>http://mitcho.com/blog/projects/exploring-command-chaining-in-ubiquity-part-1/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 20:35:37 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[nountypes]]></category>
		<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[verbs]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=2760</guid>
		<description><![CDATA[Since the dawn of time people have been asking about command chaining in Ubiquity. If you have a translate command and an email command, it would be great to be able to, for example, translate hello to Spanish and email to Juanito. This is what we call command chaining or piping: in a single complex [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/link/command-chaining-with-oni/' rel='bookmark' title='Command Chaining with Oni?'>Command Chaining with Oni?</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Since the <a href="http://labs.mozilla.com/2008/08/introducing-ubiquity/">dawn of time</a> people have been asking about command chaining in Ubiquity. If you have a <code>translate</code> command and an <code>email</code> command, it would be great to be able to, for example, <code>translate hello to Spanish and email to Juanito</code>. This is what we call <strong>command chaining</strong> or <strong><a href="http://en.wikipedia.org/wiki/Pipeline_(Unix)">piping</a></strong>: in a single complex query, specifying multiple (probably two) actions and using the first&#8217;s output as the second&#8217;s input.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></p>

<p>Today I hope to cover some of the technical considerations required in implementing command chaining in Ubiquity, and I will follow up soon with a blog post on the linguistic considerations required as well.</p>

<p><span id="more-2760"></span></p>

<h3>Technical considerations: hooking the pipes together</h3>

<p>I&#8217;d first like to lay out some technical challenges and questions. These can be broken into two different categories: (1) how the parse and display of suggestions is affected and (2) how the execution is affected.</p>

<h4>Matching inputs and outputs</h4>

<p>We&#8217;ll first consider how command chaining may affect the parsing. Ubiquity commands each specify the types of argument inputs that it expects using different <strong>noun types</strong>, such as <code>noun_arb_text</code> which accepts anything, <code>noun_type_number</code> which accepts numbers, or <code>noun_type_language</code>, which takes the name of a language. For example, the <code>translate</code> verb takes maximally three arguments: a <code>noun_arb_text</code> object, a <code>noun_type_language</code> goal (the language to translate into), and a <code>noun_type_language</code> source (the source language). In implementing command chaining, it will be necessary to identify the appropriate noun types for the <em>output</em> of a command.</p>

<p>The first question we must address here is <strong>&#8220;what is the chaining output of a command&#8221;?</strong> Is it the preview text? Some text output from the execution?</p>

<p><a href='http://www.flickr.com/photos/joemud/2851415655/'><img src="http://mitcho.com/blog/wp-content/uploads/2009/08/2851415655_1012a4cce0_o.jpg" alt="2851415655_1012a4cce0_o.jpg" border="0" width="650" height="226" /></a><br/><small><a href='http://www.flickr.com/photos/joemud/2851415655/'>Big fish eat da lil fish</a> by joemud, CC-SA-NC</small></p>

<p>To put this question into perspective, we note that Ubiquity commands can be broadly classified into two types: <strong>lookup</strong> and <strong>action execution</strong>. Here&#8217;s a classification which I believe to be exhaustive:<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup></p>

<table>
<tr><th>classification</th><th>preview</th><th>execution</th><th>example</th></tr>
<tr><td rowspan='4'>lookup</td><td rowspan='4'>data lookup</td><td>inserting result into page</td><td><code>translate</code></td></tr>
<tr><td>opening a website</td><td><code>weather</code>, most search commands</td></tr>
<tr><td>copying result to pasteboard</td><td><code>get email address</code></td></tr>
<tr><td>nothing</td><td><code></code></td></tr>
<tr><td>action</td><td>nothing (maybe a description<br/>of what the action will do)</td><td>an action which changes some state <br/>(in the browser or on the web)</td><td><code>quit firefox</code>, <code>email</code>, <code>twitter</code></td></tr>
</table>

<p>In light of this classification I believe we can say that lookup commands are much more likely to be the first verb in a command chain—conversely, chains such as <code>email hello to Blair and then do ...</code> or <code>twitter hello and then ...</code> are quite unlikely. What is much more likely is for the first verb to be a lookup function.</p>

<table>
<tr><th>first verb type</th><th>second verb type</th><th>example</th></tr>
<tr><td>lookup</td><td>action</td><td><code>translate this to Spanish and email to Aza</code></td>
<tr><td>lookup</td><td>lookup</td><td><code>translate this to English and then find it with Amazon</code></td>
<tr><td>action</td><td>action/lookup</td><td><i>no use case?</i></td>
</table>

<p>Thus in the same way that not all commands have a useful execution<sup id="fnref:3"><a href="#fn:3" rel="footnote">3</a></sup> <strong>perhaps only lookup commands will have a chainable output: the results of the lookup.</strong> Even with this restriction, we will most likely need to implement a new &#8220;chainable output&#8221; method or getter in these commands. This means that commands will need to opt-in to become chainable, but I believe this is a necessary evil.</p>

<p>The second question we must address is <strong>&#8220;when do we establish the noun type of a command&#8217;s chainable output?&#8221;</strong> One unsung but crucial feature of the way Ubiquity works now is that suggestions&#8217; previews are not computed until that suggestion is selected (except for the first suggestion, which in most skins gets previewed immediately). Should we wait for all of the first verbs&#8217; chainable output to be computed and then run them through the <a href="http://mitcho.com/blog/projects/judging-noun-types/">noun type detection system</a>? Or should verbs with chainable output also <em>a priori</em> specify what noun types their output will be?</p>

<p>Both of these approaches have their problems. If we compute the chainable output of the first verb, run a noun type detection on it and <em>then</em> suggest the full combination if it matches what the second verb was expecting, this will have clear performance implications, not to mention that it could greatly complicate our <a href="https://wiki.mozilla.org/Labs/Ubiquity/Parser_2">parsing algorithm</a>. While the latter approach doesn&#8217;t have these performance implications, it does mean that it will have to list (by name or reference) the noun types that will match its output, meaning that if a command author is unaware of someone else&#8217;s noun type, that chain will be impossible, even if the chainable output itself does indeed match that noun type. The <em>a posteriori</em> approach would never have this issue. <strong>What other benefits or problems do you forsee with either of these approaches? Is there another approach which avoids these pitfalls?</strong></p>

<h4>(A)synchronous composability</h4>

<p>Once we have the noun types, parsing, and suggestions down, all that remains is to compute the previews and implement the composite execution. Since the Ubiquity command manager already wraps the preview and execute functions in a wrapper to facilitate localization, among other uses, it would be easy to make the command manager <a href="http://www.croczilla.com/blog/16">compose asynchronous processes pseudo-synchronously</a>. No major changes should be necessary to do the previews and executions, though, again, there will be a performance cost.</p>

<h3>Conclusion</h3>

<p>There are a number of technical questions which must be answered, mostly in the parsing/suggesting stage. The key questions to answer are:</p>

<ol>
<li>What is the chaining output of a command?</li>
<li>When do we establish the noun type of a command&#8217;s chainable output?</li>
</ol>

<p>I&#8217;ll make another post soon on the linguistic considerations necessary in making command chaining happen in a <a href="http://mitcho.com/blog/projects/how-natural-should-a-natural-interface-be/">natural</a> fashion.</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>We&#8217;re going to limit our discussion here to this restriction that the two verbs are not simply two simultaneous commands, but two commands which operate successively on an input, i.e., that it is true piping. This for example rules out input such as <code>google dogs and translate cat to Spanish</code>, as the second command&#8217;s execution does not semantically depend on the first&#8217;s execution. This (hopefully uncontroversial) decision also affects the linguistic considerations to be made in my next post.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:2">
<p>If you know of a command which doesn&#8217;t neatly fit into &#8220;lookup&#8221; or &#8220;action&#8221;, please let me know.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:3">
<p>I believe we should mark these no-execution lookup commands visually so the user does not expect anything to happen if they execute it. This is <a href="http://ubiquity.mozilla.com/trac/ticket/651">trac #651</a>.&#160;<a href="#fnref:3" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/link/command-chaining-with-oni/' rel='bookmark' title='Command Chaining with Oni?'>Command Chaining with Oni?</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-commands-by-the-numbers/' rel='bookmark' title='Ubiquity Commands by The Numbers'>Ubiquity Commands by The Numbers</a></li>
<li><a href='http://mitcho.com/blog/projects/ubiquity-parser-the-next-generation-demo/' rel='bookmark' title='Ubiquity Parser: The Next Generation Demo'>Ubiquity Parser: The Next Generation Demo</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/projects/exploring-command-chaining-in-ubiquity-part-1/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Command Chaining with Oni?</title>
		<link>http://mitcho.com/blog/link/command-chaining-with-oni/</link>
		<comments>http://mitcho.com/blog/link/command-chaining-with-oni/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 09:41:29 +0000</pubDate>
		<dc:creator>mitcho</dc:creator>
				<category><![CDATA[link]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[composition]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mozilla Planet]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[ubiquity]]></category>

		<guid isPermaLink="false">http://mitcho.com/blog/?p=1952</guid>
		<description><![CDATA[There are two challenges to implementing so-called command chaining, but only one of them is choosing a linguistically appropriate structural standard and parsing it. The other is the underlying difficulty of processing each individual &#8220;clause&#8221; in sequence, asynchronously. Alex Fritze blogged about how a project like his own Oni could dramatically simplify this underlying process. [...]
Related posts:<ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-i18n-questions-to-ask/' rel='bookmark' title='Ubiquity i18n: questions to ask'>Ubiquity i18n: questions to ask</a></li>
<li><a href='http://mitcho.com/blog/observation/wheres-the-verb/' rel='bookmark' title='Where&#8217;s The Verb?'>Where&#8217;s The Verb?</a></li>
<li><a href='http://mitcho.com/blog/projects/count-command-for-ubiquity/' rel='bookmark' title='Count command for Ubiquity'>Count command for Ubiquity</a></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>There are two challenges to implementing so-called <a href="https://ubiquity.mozilla.com/trac/ticket/255">command chaining</a>, but only one of them is choosing a linguistically appropriate structural standard and parsing it. The other is the underlying difficulty of processing each individual &#8220;clause&#8221; in sequence, asynchronously. <a href="http://www.croczilla.com">Alex Fritze</a> blogged about how a project like his own <a href="http://www.croczilla.com/oni">Oni</a> could dramatically simplify this underlying process.</p>

<p><a href="http://www.croczilla.com/blog/16">Ubiquity, Oni, and Composability</a>:</p>

<blockquote>but I cannot instruct it to give me list of translated google results:

<pre>translate (google foo) to German  // doesn't work</pre>

Or email me the resulting list:

<pre>email(translate (google foo) to German) // doesn't work</pre>

&#8230;So how does Oni relate to this? Oni is a browser-based &#8220;embedded structured concurrency framework&#8221;. It allows you to write asynchronous code as if it was synchronous, adding back the kind-of composibility that is lost when juggling concurrent strands of execution (such as e.g. pending XMLHttpRequests) with &#8216;conventional&#8217; sequential languages.</blockquote>
<p>Related posts:</p><ol>
<li><a href='http://mitcho.com/blog/projects/ubiquity-i18n-questions-to-ask/' rel='bookmark' title='Ubiquity i18n: questions to ask'>Ubiquity i18n: questions to ask</a></li>
<li><a href='http://mitcho.com/blog/observation/wheres-the-verb/' rel='bookmark' title='Where&#8217;s The Verb?'>Where&#8217;s The Verb?</a></li>
<li><a href='http://mitcho.com/blog/projects/count-command-for-ubiquity/' rel='bookmark' title='Count command for Ubiquity'>Count command for Ubiquity</a></li>
</ol>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://mitcho.com/blog/link/command-chaining-with-oni/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

