<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>The Xo book on Xo Language</title><link>https://xolang.dev/docs/book/</link><description>Recent content in The Xo book on Xo Language</description><generator>Hugo</generator><language>en-US</language><atom:link href="https://xolang.dev/docs/book/index.xml" rel="self" type="application/rss+xml"/><item><title>Effects and capabilities</title><link>https://xolang.dev/docs/book/01-effects-and-capabilities/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://xolang.dev/docs/book/01-effects-and-capabilities/</guid><description>&lt;p&gt;In most languages any function can open a file, read the clock, or call the&#10;network, and you find out by reading its body. In Xo the signature says it.&#10;Two ideas work together:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;an &lt;strong&gt;effect&lt;/strong&gt; is a name in the &lt;code&gt;uses&lt;/code&gt; clause (&lt;code&gt;fs.read&lt;/code&gt;, &lt;code&gt;clock&lt;/code&gt;, &lt;code&gt;stdio&lt;/code&gt;);&lt;/li&gt;&#10;&lt;li&gt;a &lt;strong&gt;capability&lt;/strong&gt; is a value (&lt;code&gt;Fs&lt;/code&gt;, &lt;code&gt;Clock&lt;/code&gt;, &lt;code&gt;Stdio&lt;/code&gt;) that grants the&#10;permission. &lt;code&gt;main&lt;/code&gt; receives them all in &lt;code&gt;os: Os&lt;/code&gt;; everything else must be&#10;passed one.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="pure-and-what-it-costs-to-stop-being-pure"&gt;Pure, and what it costs to stop being pure&lt;/h2&gt;&#10;&lt;p&gt;&lt;code&gt;caps-basics/main.xo&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Error handling</title><link>https://xolang.dev/docs/book/02-error-handling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://xolang.dev/docs/book/02-error-handling/</guid><description>&lt;p&gt;Xo has two kinds of failure, and the language keeps them apart:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;an &lt;strong&gt;error&lt;/strong&gt; is something the caller can reasonably handle (bad input, a&#10;missing file). It is a value in the return type after &lt;code&gt;!&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;a &lt;strong&gt;fault&lt;/strong&gt; is a bug (a broken &lt;code&gt;requires&lt;/code&gt;, an index out of range). It&#10;stops the task, and only an isolation boundary turns it into a value.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="layered-errors-with-from"&gt;Layered errors with &lt;code&gt;from&lt;/code&gt;&lt;/h2&gt;&#10;&lt;p&gt;Each layer has its own error enum. A &lt;code&gt;from&lt;/code&gt; variant lets &lt;code&gt;?&lt;/code&gt; convert a lower&#10;layer&amp;rsquo;s error into the upper one.&lt;/p&gt;</description></item></channel></rss>