<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[Important Shock]]></provider_name><provider_url><![CDATA[https://importantshock.wordpress.com]]></provider_url><author_name><![CDATA[Patrick Thomson]]></author_name><author_url><![CDATA[https://importantshock.wordpress.com/author/importantshock/]]></author_url><title><![CDATA[Inform 7: Natural-Language Programming&nbsp;Lives]]></title><type><![CDATA[link]]></type><html><![CDATA[<p>When most programmers think of natural-language programming, they usually think of <a href="http://en.wikipedia.org/wiki/Applescript">Applescript</a> &#8211; an ambitious yet doomed-to-failure language with <a href="http://en.wikipedia.org/wiki/Applescript#The_natural_language_metaphor">English-like syntax</a> that Apple developed in order to automate OS scripting tasks. Frankly, Applescript in its current incarnation is pretty dismal &#8211; any reasonably complex script is positively overflowing with <code>end</code>s and <code>tell</code>s, reminiscent of Ruby&#8217;s slower, dumber cousin. (Incidentally, 99% of the pain of Applescript can be removed with <a href="http://rubyosa.rubyforge.org/">Ruby</a> or <a href="http://appscript.sourceforge.net/">Python</a> bridges.)</p>
<p>These painful memories, combined with <a href="http://www.cs.utexas.edu/users/EWD/transcriptions/EWD06xx/EWD667.html">other influential condemnations</a>, will probably lead many programmers to shun <a href="http://www.inform-fiction.org/I7/Inform%207.html">Inform 7</a> and its mission to be &#8220;built by writing natural English-language sentences.&#8221; However, if you will wait a moment, I will show you the masterful elegance with which Inform 7 mixes modern programming paradigms and the English language.</p>
<p>For those of you unfamiliar with Inform, it&#8217;s a system for writing text adventures &#8211; well-known examples include Adventure, Zork, and the famously difficult adaptation of The Hitchhiker&#8217;s Guide to the Galaxy. Inform was created in 1993; in its first six versions, games were written in a procedural programming language with a syntax looking like a cross between Perl and Applescript. Now, however, games are written entirely in English and then translated with the I7 compiler.</p>
<p>The following is not meant to be a full-fledged I7 tutorial; the official site does that far better than I ever could. This is simply a demonstration of how I7 manages to express complex programming concepts entirely in English.</p>
<p><!--more--></p>
<p>Let&#8217;s look at how we instantiate objects:</p>
<p><code>The hall is a room.</code></p>
<p>There, that&#8217;s it. Same thing as <code>hall = Room.new()</code> or what have you. Its name &#8220;The hall&#8221; will be displayed correctly when the player enters, leaves or observes it.</p>
<p>What about making new types of objects?</p>
<p><code>A bathroom is a kind of room.</code></p>
<p>Ooh! Subclassing! Inheritance! And it does it concisely and readably, and without using any terms such as &#8220;public&#8221;, &#8220;class&#8221;, or &#8220;extends&#8221;!</p>
<p><code>Rooms can be clean, dirty, or filthy.<br />
Bathrooms are usually dirty.</code></p>
<p>Dynamic programming! We can edit the properties of built-in objects, a lá Smalltalk and Ruby!</p>
<p><code>The oil drum is a thing. The oil drum is enterable.</code></p>
<p>&#8220;Enterable&#8221; in this case is like a Ruby mixin &#8211; it allows the player to get in and out of the oil drum and provides it with all the attributes that entails.</p>
<p><code>Color is a kind of value. The colors are blue, red and green.<br />
Instead of touching the button: change the color of the button to red.</code></p>
<p>Note the definition of new enumerable types, subclassing methods (in this case, &#8216;touching&#8217;) on existing objects, and changing attribute values.</p>
<p><em>These are complicated concepts</em> and the fact that the Inform 7 designers have made them expressible in concise English is, frankly, astounding.</p>
<p>Go check it out; write the Dramatic Lovecraftian Adventure you&#8217;ve had brewing up in your mind for the past few years. It&#8217;ll be fun.</p>
]]></html></oembed>