<?xml version="1.0" encoding="iso-8859-1" ?>
<rss version="2.0" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/html" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>The Sourcerer</title><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi</link><description>by Kris Kowal</description><language>en</language><ttl>60</ttl><dc:creator>kris.kowal@gmail.com</dc:creator><admin:generatorAgent rdf:resource="http://pyblosxom.sourceforge.net/"/><admin:errorReportsTo rdf:resource="mailto:none"/><item><title>Tale Update</title><guid isPermaLink="false">art/tale/penguins-and-such</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/art/tale/penguins-and-such</link><description>
&lt;p&gt;I'm not exactly on schedule for &lt;a href=&quot;http://tale.im&quot;&gt;Tale&lt;/a&gt; (I intended to have a playable alpha this month), but here's your consolation prize: art updates.&lt;/p&gt;
&lt;p&gt;I recently added &lt;a href=&quot;https://cixar.com/tale/wiki/FireDrake&quot;&gt;Fire Drakes&lt;/a&gt; and ducks to the Tale managerie.  You'll encounter varous breeds of Fire Drake Elementals and Alloyals throughout the eastern face of the world, &lt;a href=&quot;https://cixar.com/tale/wiki/Oria&quot;&gt;Oria&lt;/a&gt;.  The brave and, more importantly, resilient will eventually encounter &lt;a href=&quot;https://cixar.com/tale/wiki/FrancisDrake&quot;&gt;FrancisDrake&lt;/a&gt;, the drake leader.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cixar.com/tale/art/monster/fire-drake-gold-100.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://cixar.com/tale/art/monster/francis-drake-100.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Additionally, those daring to travel south to &lt;a href=&quot;https://cixar.com/tale/wiki/Austra&quot;&gt;Austra&lt;/a&gt; will eventually encounter first patrols, squadrons, platoons, companies, battalions, regiments, brigades, divisions, corps, and eventually &lt;i&gt;hordes&lt;/i&gt; of &lt;a href=&quot;https://cixar.com/tale/wiki/Penguin&quot;&gt;penguins&lt;/a&gt;.  The penguin collective recently added an air-force to their numbers with propellor-beanie sporting aerial grenadier penguins, &lt;a href=&quot;https://cixar.com/tale/wiki/AeroPenguin&quot;&gt;Aero-pengins&lt;/a&gt;, and ballistic-missile ground forces, &lt;a href=&quot;https://cixar.com/tale/wiki/RocketPenguin&quot;&gt;Rocket-penguins&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cixar.com/tale/art/monster/penguin-100.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://cixar.com/tale/art/monster/rocket-penguin-100.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://cixar.com/tale/art/monster/aero-penguin-100.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;The penguins appear to be gearing up for war with &lt;a href=&quot;https://cixar.com/tale/wiki/Borea&quot;&gt;Borea&lt;/a&gt;, however, &lt;a href=&quot;https://cixar.com/tale/wiki/MagusBorealis&quot;&gt;the red mage of the North&lt;/a&gt; will not be caught with his snow-pants down.  The elves have recruited the not-so-friendly &lt;a href=&quot;https://cixar.com/tale/wiki/PolerBear&quot;&gt;poler-bears&lt;/a&gt; to introduce penguin to their rich baby-seal diet.  The &lt;a href=&quot;https://cixar.com/tale/wiki/Narwhal&quot;&gt;narwhal&lt;/a&gt; claims neutrality and you're not likely to find him unless you dive in the frigid &lt;a href=&quot;https://cixar.com/tale/wiki/BorealSea&quot;&gt;Boreal Sea&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cixar.com/tale/art/monster/poler-bear-100.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://cixar.com/tale/art/monster/narwhal-100.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Plans are under-way to populate all of the evil faces of the world with popular open-source mascots.  You can expect to see the BSD &lt;a href=&quot;https://cixar.com/tale/wiki/Daemon&quot;&gt;Daemon&lt;/a&gt; in the hell-world of &lt;a href=&quot;https://cixar.com/tale/wiki/Dysia&quot;&gt;Dysia&lt;/a&gt;, and maybe even &lt;a href=&quot;https://cixar.com/tale/wiki/FireFox&quot;&gt;Fire-foxen&lt;/a&gt; in &lt;a href=&quot;https://cixar.com/tale/wiki/Oria&quot;&gt;Oria&lt;/a&gt;.  Drop me a line if you think of an appropriate mascot for the /East, perhaps involving fire or ducks, especially if it continues the theme of rougue operating systems.&lt;/p&gt;
&lt;p&gt;On a completely different topic, there is new art for Tale accessories including a morning-star, the &lt;a href=&quot;https://cixar.com/tale/wiki/BrickOfPower&quot;&gt;brick-of-power&lt;/a&gt;, and the &lt;a href=&quot;https://cixar.com/tale/wiki/iTome&quot;&gt;iTome&lt;/a&gt; for &lt;a href=&quot;https://cixar.com/tale/wiki/Manic&quot;&gt;manic&lt;/a&gt; fighters.  These &lt;a href=&quot;https://cixar.com/tale/wiki/Items&quot;&gt;items&lt;/a&gt; will be available on the ever-popular face 5, &lt;a href=&quot;https://cixar.com/tale/wiki/Occia&quot;&gt;Occia&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cixar.com/tale/art/item/power-brick-100.png&quot; alt=&quot;&quot;&gt; &lt;img src=&quot;https://cixar.com/tale/art/item/itome-100.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;That gives me &lt;s&gt;a good&lt;/s&gt; an idea.  Perhaps there should be an operating system for &lt;i&gt;every&lt;/i&gt; face!  Faces 6, 5, and 4 (good) would be commercial operating systems while faces 1, 2, 3 (evil) would be open-source.  Face 6 will obviously be blighted with drafts; does anybody have an idea for &lt;a href=&quot;https://cixar.com/tale/wiki/Borea&quot;&gt;Borea&lt;/a&gt;, the north pole?&lt;/p&gt;
&lt;p&gt;Also, there's a new item for your initial inventory when you start the game in Euia, a &lt;a href=&quot;https://cixar.com/tale/wiki/Spork&quot;&gt;spork&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://cixar.com/tale/art/item/spork-100.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>I'm not exactly on schedule for <a href="http://tale.im">Tale</a> (I intended to have a playable alpha this month), but here's your consolation prize: art updates.</p>
<p>I recently added <a href="https://cixar.com/tale/wiki/FireDrake">Fire Drakes</a> and ducks to the Tale managerie.  You'll encounter varous breeds of Fire Drake Elementals and Alloyals throughout the eastern face of the world, <a href="https://cixar.com/tale/wiki/Oria">Oria</a>.  The brave and, more importantly, resilient will eventually encounter <a href="https://cixar.com/tale/wiki/FrancisDrake">FrancisDrake</a>, the drake leader.</p>
<p><img src="https://cixar.com/tale/art/monster/fire-drake-gold-100.png" alt=""> <img src="https://cixar.com/tale/art/monster/francis-drake-100.png" alt=""></p>
<p>Additionally, those daring to travel south to <a href="https://cixar.com/tale/wiki/Austra">Austra</a> will eventually encounter first patrols, squadrons, platoons, companies, battalions, regiments, brigades, divisions, corps, and eventually <i>hordes</i> of <a href="https://cixar.com/tale/wiki/Penguin">penguins</a>.  The penguin collective recently added an air-force to their numbers with propellor-beanie sporting aerial grenadier penguins, <a href="https://cixar.com/tale/wiki/AeroPenguin">Aero-pengins</a>, and ballistic-missile ground forces, <a href="https://cixar.com/tale/wiki/RocketPenguin">Rocket-penguins</a>.</p>
<p><img src="https://cixar.com/tale/art/monster/penguin-100.png" alt=""> <img src="https://cixar.com/tale/art/monster/rocket-penguin-100.png" alt=""> <img src="https://cixar.com/tale/art/monster/aero-penguin-100.png" alt=""></p>
<p>The penguins appear to be gearing up for war with <a href="https://cixar.com/tale/wiki/Borea">Borea</a>, however, <a href="https://cixar.com/tale/wiki/MagusBorealis">the red mage of the North</a> will not be caught with his snow-pants down.  The elves have recruited the not-so-friendly <a href="https://cixar.com/tale/wiki/PolerBear">poler-bears</a> to introduce penguin to their rich baby-seal diet.  The <a href="https://cixar.com/tale/wiki/Narwhal">narwhal</a> claims neutrality and you're not likely to find him unless you dive in the frigid <a href="https://cixar.com/tale/wiki/BorealSea">Boreal Sea</a>.</p>
<p><img src="https://cixar.com/tale/art/monster/poler-bear-100.png" alt=""> <img src="https://cixar.com/tale/art/monster/narwhal-100.png" alt=""></p>
<p>Plans are under-way to populate all of the evil faces of the world with popular open-source mascots.  You can expect to see the BSD <a href="https://cixar.com/tale/wiki/Daemon">Daemon</a> in the hell-world of <a href="https://cixar.com/tale/wiki/Dysia">Dysia</a>, and maybe even <a href="https://cixar.com/tale/wiki/FireFox">Fire-foxen</a> in <a href="https://cixar.com/tale/wiki/Oria">Oria</a>.  Drop me a line if you think of an appropriate mascot for the /East, perhaps involving fire or ducks, especially if it continues the theme of rougue operating systems.</p>
<p>On a completely different topic, there is new art for Tale accessories including a morning-star, the <a href="https://cixar.com/tale/wiki/BrickOfPower">brick-of-power</a>, and the <a href="https://cixar.com/tale/wiki/iTome">iTome</a> for <a href="https://cixar.com/tale/wiki/Manic">manic</a> fighters.  These <a href="https://cixar.com/tale/wiki/Items">items</a> will be available on the ever-popular face 5, <a href="https://cixar.com/tale/wiki/Occia">Occia</a>.</p>
<p><img src="https://cixar.com/tale/art/item/power-brick-100.png" alt=""> <img src="https://cixar.com/tale/art/item/itome-100.png" alt=""></p>
<p>That gives me <s>a good</s> an idea.  Perhaps there should be an operating system for <i>every</i> face!  Faces 6, 5, and 4 (good) would be commercial operating systems while faces 1, 2, 3 (evil) would be open-source.  Face 6 will obviously be blighted with drafts; does anybody have an idea for <a href="https://cixar.com/tale/wiki/Borea">Borea</a>, the north pole?</p>
<p>Also, there's a new item for your initial inventory when you start the game in Euia, a <a href="https://cixar.com/tale/wiki/Spork">spork</a>.</p>
<p><img src="https://cixar.com/tale/art/item/spork-100.png" alt=""></p>
]]></content:encoded><category domain="http://cixar.com">art/tale</category><dc:date>2008-08-03T04:06:55Z</dc:date></item><item><title>Got Style?</title><guid isPermaLink="false">program/javascript/chiron/style</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/chiron/style</link><description>
&lt;p&gt;There's a new JavaScript library from Google on the block.  So, I'm of course out to absorb the good bits for Chiron.  I've got to wonder some times whether people have started to use ideas from my code.&lt;/p&gt;
&lt;p&gt;Compare &lt;a href=&quot;http://code.google.com/p/doctype/source/browse/trunk/goog/util/uri.js#909&quot;&gt;this bit&lt;/a&gt; from Google's JavaScript library with &lt;a href=&quot;https://cixar.com/tracs/javascript/browser/trunk/src/modules.js#L1074&quot;&gt;this one&lt;/a&gt; in Chiron.&lt;/p&gt;
&lt;p&gt;I don't hear much about people using Chiron.  Could this be a sign that people have been reading it and absorbing the good bits?  There are other parallels.  For example, some of the function names and file names match up with Chiron too, like &lt;tt&gt;base.js&lt;/tt&gt; and &lt;tt&gt;inherits&lt;/tt&gt; (instead of Doug Crockford's recommended term, &lt;tt&gt;begets&lt;/tt&gt;).&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>There's a new JavaScript library from Google on the block.  So, I'm of course out to absorb the good bits for Chiron.  I've got to wonder some times whether people have started to use ideas from my code.</p>
<p>Compare <a href="http://code.google.com/p/doctype/source/browse/trunk/goog/util/uri.js#909">this bit</a> from Google's JavaScript library with <a href="https://cixar.com/tracs/javascript/browser/trunk/src/modules.js#L1074">this one</a> in Chiron.</p>
<p>I don't hear much about people using Chiron.  Could this be a sign that people have been reading it and absorbing the good bits?  There are other parallels.  For example, some of the function names and file names match up with Chiron too, like <tt>base.js</tt> and <tt>inherits</tt> (instead of Doug Crockford's recommended term, <tt>begets</tt>).</p>
]]></content:encoded><category domain="http://cixar.com">program/javascript/chiron</category><dc:date>2008-05-14T23:48:20Z</dc:date></item><item><title>Re: Recommendations for the Fourth Edition of the ECMAScript Programming Language Specification</title><guid isPermaLink="false">program/javascript/re-crockford-javascript-recommendations</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/re-crockford-javascript-recommendations</link><description>
&lt;p&gt;&lt;a href=&quot;http://www.crockford.com/&quot;&gt;Doug Crockford&lt;/a&gt; has posted some &lt;a href=&quot;http://javascript.crockford.com/recommend.html&quot;&gt;recommendations&lt;/a&gt; to improve JavaScript.&lt;/p&gt;
&lt;p&gt;I have some comments in the context of my experience with live-patching JavaScript issues with libraries.&lt;/p&gt;


&lt;h2&gt;
	New Features
&lt;/h2&gt;


&lt;h3&gt;
	Function Reflection
&lt;/h3&gt;
&lt;p&gt;Doug recommends that function objects contain a &quot;name&quot; property.  Some versions of JavaScript actually have this already.  This could be handy but I haven't needed this and would not be likely to use it.  I was surprised that FireFox had this when I used a &lt;tt&gt;Function&lt;/tt&gt; in a &lt;tt&gt;with&lt;/tt&gt; block.  I've learned my lesson.&lt;/p&gt;
&lt;p&gt;However, Doug also recommends the addition of an &lt;tt&gt;arguments&lt;/tt&gt; member to &lt;tt&gt;Function&lt;/tt&gt; objects.  This is a critical feature.  The &lt;tt&gt;arguments&lt;/tt&gt; array would contain the names of all of the functions declared argument variables.  &lt;tt&gt;Function&lt;/tt&gt; objects already have a &lt;tt&gt;length&lt;/tt&gt; member that corresponds to the length of this hypothetical &lt;tt&gt;arguments&lt;/tt&gt; array.  There was some &lt;a href=&quot;http://ejohn.org/blog/javascript-method-overloading/&quot;&gt;buzz&lt;/a&gt; about using this value for method overloading and it permitted me to create an elegant &lt;a href=&quot;https://cixar.com/tracs/javascript/browser/trunk/src/base.js?rev=328#L1437&quot;&gt;partial application decorator&lt;/a&gt;.  If we had access to the names of a function's argument declarations, I could implement a decorator for supporting Python-style positional and named arguments.  Decorated functions would accept an array/list of positional arguments and an object/dict/map of keyword arguments and the decorator would translate them to an array for a wrapped &lt;tt&gt;Function.apply&lt;/tt&gt;.  That decorator or further decorators could support default values and automatic argument length assertions.&lt;/p&gt;


&lt;h3&gt;
	&lt;tt&gt;typeOf&lt;/tt&gt;
&lt;/h3&gt;
&lt;p&gt;Doug notes that JavaScript's &lt;tt&gt;typeof&lt;/tt&gt; &quot;function&quot; is broken because it returns the wrong strings for &lt;tt&gt;null&lt;/tt&gt; and arrays.  All that and he hints that using camelCase instead of lowercase would have been more in keeping with the language's aesthetic.  He recommends that we deprecate &lt;tt&gt;typeof&lt;/tt&gt; and replace it with a fixed version called &lt;tt&gt;typeOf&lt;/tt&gt;.  I would go a step further.  &lt;tt&gt;typeof&lt;/tt&gt; returns a string.  I propose that it ought to return the type object.  This would jive well with &lt;tt&gt;instanceof&lt;/tt&gt;, &lt;tt&gt;instanceOf&lt;/tt&gt;, or &lt;tt&gt;isInstance&lt;/tt&gt;.  This means there should be a &lt;tt&gt;Null&lt;/tt&gt; type that would construct &lt;tt&gt;null&lt;/tt&gt; and an &lt;tt&gt;Undefined&lt;/tt&gt; type to construct &lt;tt&gt;undefined&lt;/tt&gt;.&lt;/p&gt;


&lt;h2&gt;
	Object Methods
&lt;/h2&gt;


&lt;h3&gt;
	Don't Enum
&lt;/h3&gt;
&lt;p&gt;I don' particularly care whether &lt;tt&gt;Object&lt;/tt&gt; has a &lt;tt&gt;dontEnum&lt;/tt&gt; method since I don't augment base types and wrap them when I need reliable collection types, but this would help ameliorate integration woes with prototype so it's a good idea.&lt;/p&gt;


&lt;h3&gt;
	Array of Keys
&lt;/h3&gt;
&lt;p&gt;Doug wants a &lt;tt&gt;Object.arrayOfKeys&lt;/tt&gt; method.  I want a &lt;tt&gt;keys&lt;/tt&gt; method that returns a &lt;tt&gt;Set&lt;/tt&gt;.  I would also like &lt;tt&gt;keysIter&lt;/tt&gt; and, less emphatically, &lt;tt&gt;keysArray&lt;/tt&gt;.  I don't want the name &lt;tt&gt;arrayOfKeys&lt;/tt&gt; because it introduces an unnecessary &lt;tt&gt;Of&lt;/tt&gt; and doesn't sort as well as &lt;tt&gt;keys*&lt;/tt&gt;.&lt;/p&gt;


&lt;h3&gt;
	Array of Values.
&lt;/h3&gt;
&lt;p&gt;Doug also wants &lt;tt&gt;Object.arrayOfValues&lt;/tt&gt;.  I want &lt;tt&gt;values&lt;/tt&gt; and &lt;tt&gt;valuesIter&lt;/tt&gt;.  These should return &lt;tt&gt;Array&lt;/tt&gt; and &lt;tt&gt;Iter&lt;/tt&gt; object respectively.&lt;/p&gt;


&lt;h3&gt;
	toJsonString
&lt;/h3&gt;
&lt;p&gt;&lt;tt&gt;Object.toJSONString(memberName)&lt;/tt&gt;.  The first thing that comes to mind to improve this idea is to rename it &lt;tt&gt;toJsonString&lt;/tt&gt;; I prefer to consider acronyms words and I would have also called &lt;tt&gt;XMLHttpRequest&lt;/tt&gt; &lt;tt&gt;XmlHttpRequest&lt;/tt&gt;.  This name jives well with &lt;tt&gt;toString&lt;/tt&gt;, but I would have called that &lt;tt&gt;string&lt;/tt&gt;.  But, I actually would call this &lt;tt&gt;repr&lt;/tt&gt; and made it a global function.  &lt;tt&gt;repr&lt;/tt&gt; would work on arbitrary objects, a subset of which would be serializable JSON.  The behavior of &lt;tt&gt;repr&lt;/tt&gt; would be overridable by providing a &lt;tt&gt;repr&lt;/tt&gt; method on an object.&lt;/p&gt;


&lt;h3&gt;
	Beget Object
&lt;/h3&gt;
&lt;p&gt;Doug recommends that Prototype inheritance be a little more lucid by providing a &lt;tt&gt;beget&lt;/tt&gt; function that returns a new, empty &lt;tt&gt;Object&lt;/tt&gt; that inherits from the previous.  I like this idea.  I called it &lt;tt&gt;inherit&lt;/tt&gt; in Chiron.&lt;/p&gt;


&lt;h3&gt;
	&lt;tt&gt;isEmpty&lt;/tt&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;tt&gt;isEmpty&lt;/tt&gt; would return whether an object has any properties, other than those inherited.  Sounds fine to me, although I probably would have just used number and boolean casting.  This is a good idea too though, because in JavaScript, it's hard to distinguish an Object that is being used as the base of the inheritance tree and an Object that is being used as a hash-map.  To that end, I recommend the addition of a &lt;tt&gt;Map&lt;/tt&gt; type.  &lt;tt&gt;Map&lt;/tt&gt; would have &lt;tt&gt;isEmpty&lt;/tt&gt;, &lt;tt&gt;number&lt;/tt&gt;, and &lt;tt&gt;boolean&lt;/tt&gt; functions and would implicitly cast to &lt;tt&gt;Number&lt;/tt&gt; and &lt;tt&gt;Boolean&lt;/tt&gt; based on their &lt;tt&gt;length&lt;/tt&gt; that would be reflected publically by the &lt;tt&gt;getLength&lt;/tt&gt; function.&lt;/p&gt;


&lt;h3&gt;
	Array Methods
&lt;/h3&gt;
&lt;p&gt;Doug recommends the addition of some of Mozilla's JavaScript 1.6 Array methods.  I support all of them.  However, some nomenclature refinements and specifications:&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;indexOf&lt;/tt&gt; should be augmented by a &lt;tt&gt;find&lt;/tt&gt; function that throws a &lt;tt&gt;KeyError&lt;/tt&gt; instead of returning a negative index.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;lastIndexOf&lt;/tt&gt; should be augmented by a &lt;tt&gt;findLast&lt;/tt&gt; function similar to &lt;tt&gt;find&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;every&lt;/tt&gt; should be called &lt;tt&gt;all&lt;/tt&gt;.  This function should accept an iterator or iterable and short circuit on the first failure.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;filter&lt;/tt&gt; should be called &lt;tt&gt;where&lt;/tt&gt;.  Filtering implies the opposite of finding.  To filter something is to remove it from a stream if it passes a particular condition.  &lt;tt&gt;where&lt;/tt&gt; implies that the outgoing stream should contain only those elements from the original stream that affirm the guard.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;forEach&lt;/tt&gt; is good as is.  I would like to specify that it should return &lt;tt&gt;this&lt;/tt&gt; so that &lt;tt&gt;forEach&lt;/tt&gt; calls can be chained.  This has implications on iterations that are partially consumed by a &lt;tt&gt;forEach&lt;/tt&gt; call that throws a &lt;tt&gt;StopIteration&lt;/tt&gt; exception in its continuation.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;map&lt;/tt&gt; is good as is. As a member of an array, &lt;tt&gt;each&lt;/tt&gt; should be a synonym. These functions should also be declared in global scope with opposite argument order: &lt;tt&gt;map(function, collection, [context])&lt;/tt&gt; vs &lt;tt&gt;each(collection, function, [context])&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;some&lt;/tt&gt; should be called &lt;tt&gt;any&lt;/tt&gt;.  This function should accept an iterator or iterable and short circuit on the first success.&lt;/p&gt;


&lt;h3&gt;
	String Methods
&lt;/h3&gt;
&lt;p&gt;&lt;tt&gt;trim&lt;/tt&gt; is good as is.  There should also be &lt;tt&gt;trimBegin&lt;/tt&gt; and &lt;tt&gt;trimEnd&lt;/tt&gt; or &lt;tt&gt;trimFirst&lt;/tt&gt; and &lt;tt&gt;trimLast&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;string.eval&lt;/tt&gt; is a good idea, but I've got my own ways to launder the scope chain for &lt;tt&gt;eval&lt;/tt&gt;.&lt;/p&gt;


&lt;h3&gt;
	Date Methods
&lt;/h3&gt;
&lt;p&gt;&lt;tt&gt;Date.toJSONString&lt;/tt&gt; and &lt;tt&gt;Date.toISOString&lt;/tt&gt; are both great ideas; not having them has been a problem for me in the past.  I recommend calling them &lt;tt&gt;toJsonString&lt;/tt&gt; and &lt;tt&gt;toIsoString&lt;/tt&gt;.&lt;/p&gt;


&lt;h2&gt;
	Corrections
&lt;/h2&gt;


&lt;h3&gt;
	Reserved Words
&lt;/h3&gt;
&lt;p&gt;Doug argues that identifiers in object literal notation and member dot notation should allow reserved words.  I concur.  It's a small syntax shortcut that identifiers used in member selection and object literal notation are not required to be enquoted; the language should be equally permissive for both syntax forms.&lt;/p&gt;
&lt;p&gt;Doug also argues that the list of reserved words is too long.  I have mixed feelings.  On one hand, having a long list of reserved identifiers leaves open the door for future advances in the language (some of which include type annotations, which I find dubious).  On the other hand, they muddy the name space for current code.  On the latter note, it's important that all browsers are equally strict.  Safari, at the moment, is much more strict than other browsers, so I've been surprised.&lt;/p&gt;


&lt;h2&gt;
	Object Literal Notation
&lt;/h2&gt;
&lt;p&gt;I agree that commas should be more regular throughout the language.  They should be permitted after any value, including the last in an Object or Array literal without affecting the length of either.&lt;/p&gt;


&lt;h2&gt;
	&lt;tt&gt;arguments&lt;/tt&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;tt&gt;arguments&lt;/tt&gt; should definitely be an instance of an &lt;tt&gt;Arguments&lt;/tt&gt; type that inherits from &lt;tt&gt;Array&lt;/tt&gt;.&lt;/p&gt;


&lt;h2&gt;
	Inner Functions and the Context Object (&lt;tt&gt;this&lt;/tt&gt;)
&lt;/h2&gt;
&lt;p&gt;I agree that &lt;tt&gt;this&lt;/tt&gt; should not be the global object (&lt;tt&gt;window&lt;/tt&gt;) in inner or anonymous functions.  &lt;tt&gt;this&lt;/tt&gt; should be acquired from the scope chain in such closures.  Doug claims that this is not the standard.  I recall being corrected on this point, but I also recall having been under the same impression.  I leave this as an exercise to the reader to determine the current state of affairs in various browsers.&lt;/p&gt;


&lt;h2&gt;
	Tail Recursion
&lt;/h2&gt;
&lt;p&gt;Tail recursion would be nice.&lt;/p&gt;


&lt;h2&gt;
	Deprecation
&lt;/h2&gt;
&lt;p&gt;Primitive wrappers should be eliminated.  Boxing is almost never necessary.  In fact, the use of the &lt;tt&gt;new&lt;/tt&gt; keyword could be completely obviated and code would become much more reusable since there would be no distinction between a factory method and an object constructor.&lt;/p&gt;
&lt;p&gt;I actually use the &lt;tt&gt;with&lt;/tt&gt; statement in a couple cases that are really important.  I don't recommend using it for its designed purpose, but I really do need it to stay in the language for my module system and my JavaScript shell to keep working.  FireBug, in particular, depends on this feature.&lt;/p&gt;
&lt;p&gt;Semicolon insertion was silly.  Off with its head.&lt;/p&gt;
&lt;p&gt;I don't particularly care about &lt;tt&gt;arguments.callee&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;typeof&lt;/tt&gt; has to go.&lt;/p&gt;
&lt;p&gt;Again, &lt;tt&gt;eval&lt;/tt&gt; is a necessary part of my perverse world.  I can do my own laundry.  There are, however, irresponsible uses of &lt;tt&gt;eval&lt;/tt&gt; that I do not condone.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p><a href="http://www.crockford.com/">Doug Crockford</a> has posted some <a href="http://javascript.crockford.com/recommend.html">recommendations</a> to improve JavaScript.</p>
<p>I have some comments in the context of my experience with live-patching JavaScript issues with libraries.</p>


<h2>
	New Features
</h2>


<h3>
	Function Reflection
</h3>
<p>Doug recommends that function objects contain a "name" property.  Some versions of JavaScript actually have this already.  This could be handy but I haven't needed this and would not be likely to use it.  I was surprised that FireFox had this when I used a <tt>Function</tt> in a <tt>with</tt> block.  I've learned my lesson.</p>
<p>However, Doug also recommends the addition of an <tt>arguments</tt> member to <tt>Function</tt> objects.  This is a critical feature.  The <tt>arguments</tt> array would contain the names of all of the functions declared argument variables.  <tt>Function</tt> objects already have a <tt>length</tt> member that corresponds to the length of this hypothetical <tt>arguments</tt> array.  There was some <a href="http://ejohn.org/blog/javascript-method-overloading/">buzz</a> about using this value for method overloading and it permitted me to create an elegant <a href="https://cixar.com/tracs/javascript/browser/trunk/src/base.js?rev=328#L1437">partial application decorator</a>.  If we had access to the names of a function's argument declarations, I could implement a decorator for supporting Python-style positional and named arguments.  Decorated functions would accept an array/list of positional arguments and an object/dict/map of keyword arguments and the decorator would translate them to an array for a wrapped <tt>Function.apply</tt>.  That decorator or further decorators could support default values and automatic argument length assertions.</p>


<h3>
	<tt>typeOf</tt>
</h3>
<p>Doug notes that JavaScript's <tt>typeof</tt> "function" is broken because it returns the wrong strings for <tt>null</tt> and arrays.  All that and he hints that using camelCase instead of lowercase would have been more in keeping with the language's aesthetic.  He recommends that we deprecate <tt>typeof</tt> and replace it with a fixed version called <tt>typeOf</tt>.  I would go a step further.  <tt>typeof</tt> returns a string.  I propose that it ought to return the type object.  This would jive well with <tt>instanceof</tt>, <tt>instanceOf</tt>, or <tt>isInstance</tt>.  This means there should be a <tt>Null</tt> type that would construct <tt>null</tt> and an <tt>Undefined</tt> type to construct <tt>undefined</tt>.</p>


<h2>
	Object Methods
</h2>


<h3>
	Don't Enum
</h3>
<p>I don' particularly care whether <tt>Object</tt> has a <tt>dontEnum</tt> method since I don't augment base types and wrap them when I need reliable collection types, but this would help ameliorate integration woes with prototype so it's a good idea.</p>


<h3>
	Array of Keys
</h3>
<p>Doug wants a <tt>Object.arrayOfKeys</tt> method.  I want a <tt>keys</tt> method that returns a <tt>Set</tt>.  I would also like <tt>keysIter</tt> and, less emphatically, <tt>keysArray</tt>.  I don't want the name <tt>arrayOfKeys</tt> because it introduces an unnecessary <tt>Of</tt> and doesn't sort as well as <tt>keys*</tt>.</p>


<h3>
	Array of Values.
</h3>
<p>Doug also wants <tt>Object.arrayOfValues</tt>.  I want <tt>values</tt> and <tt>valuesIter</tt>.  These should return <tt>Array</tt> and <tt>Iter</tt> object respectively.</p>


<h3>
	toJsonString
</h3>
<p><tt>Object.toJSONString(memberName)</tt>.  The first thing that comes to mind to improve this idea is to rename it <tt>toJsonString</tt>; I prefer to consider acronyms words and I would have also called <tt>XMLHttpRequest</tt> <tt>XmlHttpRequest</tt>.  This name jives well with <tt>toString</tt>, but I would have called that <tt>string</tt>.  But, I actually would call this <tt>repr</tt> and made it a global function.  <tt>repr</tt> would work on arbitrary objects, a subset of which would be serializable JSON.  The behavior of <tt>repr</tt> would be overridable by providing a <tt>repr</tt> method on an object.</p>


<h3>
	Beget Object
</h3>
<p>Doug recommends that Prototype inheritance be a little more lucid by providing a <tt>beget</tt> function that returns a new, empty <tt>Object</tt> that inherits from the previous.  I like this idea.  I called it <tt>inherit</tt> in Chiron.</p>


<h3>
	<tt>isEmpty</tt>
</h3>
<p><tt>isEmpty</tt> would return whether an object has any properties, other than those inherited.  Sounds fine to me, although I probably would have just used number and boolean casting.  This is a good idea too though, because in JavaScript, it's hard to distinguish an Object that is being used as the base of the inheritance tree and an Object that is being used as a hash-map.  To that end, I recommend the addition of a <tt>Map</tt> type.  <tt>Map</tt> would have <tt>isEmpty</tt>, <tt>number</tt>, and <tt>boolean</tt> functions and would implicitly cast to <tt>Number</tt> and <tt>Boolean</tt> based on their <tt>length</tt> that would be reflected publically by the <tt>getLength</tt> function.</p>


<h3>
	Array Methods
</h3>
<p>Doug recommends the addition of some of Mozilla's JavaScript 1.6 Array methods.  I support all of them.  However, some nomenclature refinements and specifications:</p>
<p><tt>indexOf</tt> should be augmented by a <tt>find</tt> function that throws a <tt>KeyError</tt> instead of returning a negative index.</p>
<p><tt>lastIndexOf</tt> should be augmented by a <tt>findLast</tt> function similar to <tt>find</tt>.</p>
<p><tt>every</tt> should be called <tt>all</tt>.  This function should accept an iterator or iterable and short circuit on the first failure.</p>
<p><tt>filter</tt> should be called <tt>where</tt>.  Filtering implies the opposite of finding.  To filter something is to remove it from a stream if it passes a particular condition.  <tt>where</tt> implies that the outgoing stream should contain only those elements from the original stream that affirm the guard.</p>
<p><tt>forEach</tt> is good as is.  I would like to specify that it should return <tt>this</tt> so that <tt>forEach</tt> calls can be chained.  This has implications on iterations that are partially consumed by a <tt>forEach</tt> call that throws a <tt>StopIteration</tt> exception in its continuation.</p>
<p><tt>map</tt> is good as is. As a member of an array, <tt>each</tt> should be a synonym. These functions should also be declared in global scope with opposite argument order: <tt>map(function, collection, [context])</tt> vs <tt>each(collection, function, [context])</tt>.</p>
<p><tt>some</tt> should be called <tt>any</tt>.  This function should accept an iterator or iterable and short circuit on the first success.</p>


<h3>
	String Methods
</h3>
<p><tt>trim</tt> is good as is.  There should also be <tt>trimBegin</tt> and <tt>trimEnd</tt> or <tt>trimFirst</tt> and <tt>trimLast</tt>.</p>
<p><tt>string.eval</tt> is a good idea, but I've got my own ways to launder the scope chain for <tt>eval</tt>.</p>


<h3>
	Date Methods
</h3>
<p><tt>Date.toJSONString</tt> and <tt>Date.toISOString</tt> are both great ideas; not having them has been a problem for me in the past.  I recommend calling them <tt>toJsonString</tt> and <tt>toIsoString</tt>.</p>


<h2>
	Corrections
</h2>


<h3>
	Reserved Words
</h3>
<p>Doug argues that identifiers in object literal notation and member dot notation should allow reserved words.  I concur.  It's a small syntax shortcut that identifiers used in member selection and object literal notation are not required to be enquoted; the language should be equally permissive for both syntax forms.</p>
<p>Doug also argues that the list of reserved words is too long.  I have mixed feelings.  On one hand, having a long list of reserved identifiers leaves open the door for future advances in the language (some of which include type annotations, which I find dubious).  On the other hand, they muddy the name space for current code.  On the latter note, it's important that all browsers are equally strict.  Safari, at the moment, is much more strict than other browsers, so I've been surprised.</p>


<h2>
	Object Literal Notation
</h2>
<p>I agree that commas should be more regular throughout the language.  They should be permitted after any value, including the last in an Object or Array literal without affecting the length of either.</p>


<h2>
	<tt>arguments</tt>
</h2>
<p><tt>arguments</tt> should definitely be an instance of an <tt>Arguments</tt> type that inherits from <tt>Array</tt>.</p>


<h2>
	Inner Functions and the Context Object (<tt>this</tt>)
</h2>
<p>I agree that <tt>this</tt> should not be the global object (<tt>window</tt>) in inner or anonymous functions.  <tt>this</tt> should be acquired from the scope chain in such closures.  Doug claims that this is not the standard.  I recall being corrected on this point, but I also recall having been under the same impression.  I leave this as an exercise to the reader to determine the current state of affairs in various browsers.</p>


<h2>
	Tail Recursion
</h2>
<p>Tail recursion would be nice.</p>


<h2>
	Deprecation
</h2>
<p>Primitive wrappers should be eliminated.  Boxing is almost never necessary.  In fact, the use of the <tt>new</tt> keyword could be completely obviated and code would become much more reusable since there would be no distinction between a factory method and an object constructor.</p>
<p>I actually use the <tt>with</tt> statement in a couple cases that are really important.  I don't recommend using it for its designed purpose, but I really do need it to stay in the language for my module system and my JavaScript shell to keep working.  FireBug, in particular, depends on this feature.</p>
<p>Semicolon insertion was silly.  Off with its head.</p>
<p>I don't particularly care about <tt>arguments.callee</tt>.</p>
<p><tt>typeof</tt> has to go.</p>
<p>Again, <tt>eval</tt> is a necessary part of my perverse world.  I can do my own laundry.  There are, however, irresponsible uses of <tt>eval</tt> that I do not condone.</p>
]]></content:encoded><category domain="http://cixar.com">program/javascript</category><dc:date>2008-04-25T01:40:29Z</dc:date></item><item><title>De Schpugeti</title><guid isPermaLink="false">program/javascript/chiron/deschpugeti</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/chiron/deschpugeti</link><description>
&lt;p&gt;You've heard of syntactic sugar.  After a syntax and vocabulary provides all of the normal forms necessary to express all of the programs possible in a language, yummy shortcuts bridge the gap between expressiveness and usability.  For example, &lt;tt&gt;c++&lt;/tt&gt; is a delicious variation of &lt;tt&gt;(temp = c, c = c + 1, temp)&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;You've also heard of CRUD, an acronym for the normal forms for a data programming interface (databases, data structures).  If you design an interface library for data and fail to cover all of these bases, you deserve what's coming to you&amp;nbsp;&amp;mdash;&amp;nbsp;and I can't promise that it won't involve a big hole in the ground and Hello Kitty.&lt;/p&gt;
&lt;p&gt;CRUD stands for &lt;tt&gt;&lt;u&gt;c&lt;/u&gt;reate&lt;/tt&gt;, &lt;tt&gt;&lt;u&gt;r&lt;/u&gt;ead&lt;/tt&gt;, &lt;tt&gt;&lt;u&gt;u&lt;/u&gt;pdate&lt;/tt&gt;, and &lt;tt&gt;&lt;u&gt;d&lt;/u&gt;elete&lt;/tt&gt;.  Those functions encompass all of the necessary data interactions; however, they are not sufficient.  While CRUD may provide all the nutrients, vitamins, and minerals your data API might need, it certainly won't taste good without sugar.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Enter: Chiron&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;&lt;u&gt;de&lt;/u&gt;l, &lt;u&gt;s&lt;/u&gt;et, &lt;u&gt;c&lt;/u&gt;ut, &lt;u&gt;h&lt;/u&gt;as, &lt;u&gt;pu&lt;/u&gt;t, &lt;u&gt;get&lt;/u&gt;&lt;/tt&gt;.  De Schpugeti.  All of these names are three letters long, should be familiar by their names, and are sufficient in addition to necessary.  These methods are the interface of Chiron's &lt;tt&gt;Dict&lt;/tt&gt;, for manipulating item data: data that have keys and corresponding values.  They are also implemented in a consistent manner by &lt;tt&gt;List&lt;/tt&gt; presuming that indices are like keys.&lt;/p&gt;
&lt;dl&gt;
	&lt;dt&gt;&lt;tt&gt;del&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Deletes an item for a key.&lt;br/&gt;Returns the mutated collection.&lt;br/&gt;For ordered collections, accepts a beginning key and an ending key, deleting all items in that range of keys excluding the ending key.&lt;br/&gt;Implemented in terms of &lt;tt&gt;remove&lt;/tt&gt;.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;set&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Adds or overwrites an item for a key.&lt;br/&gt;Returns the mutated collection.&lt;br/&gt;Implemented in terms of &lt;tt&gt;insert&lt;/tt&gt;.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;cut&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Deletes an item for a key.&lt;br/&gt;Throws a key error of no item has that key.&lt;br/&gt;Returns the corresponding value.&lt;br/&gt;Implemented in terms of &lt;tt&gt;get&lt;/tt&gt; and &lt;tt&gt;del&lt;/tt&gt;.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;has&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Returns whether key is among items.&lt;br/&gt;Implemented in terms of &lt;tt&gt;has&lt;/tt&gt;.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;put&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Adds an item for a key.&lt;br/&gt;Throws a key error if there is already an item with that key.  returns the mutated collection.&lt;br/&gt;In an ordered collection, reserves the right to change the keys of some other items to make room for the new item.&lt;br/&gt;Implemented in terms of &lt;tt&gt;set&lt;/tt&gt; and &lt;tt&gt;has&lt;/tt&gt;.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;get&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Returns a value for the given key.&lt;br/&gt;Throws a key error if there is no value for the given key.&lt;br/&gt;Implemented in terms of retrieve and &lt;tt&gt;has&lt;/tt&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;Also, &lt;tt&gt;List&lt;/tt&gt;s, &lt;tt&gt;Set&lt;/tt&gt;s, and, by extension, &lt;tt&gt;Dict&lt;/tt&gt;s have functions for managing collections of values that do not have keys.  &lt;tt&gt;Dict&lt;/tt&gt; is a &lt;tt&gt;Set&lt;/tt&gt; of items instead of mere values that are compared and hashed on their key.&lt;/p&gt;
&lt;dl&gt;
	&lt;dt&gt;&lt;tt&gt;has&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Returns whether a collection contains a particular value.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;insert&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Adds or overwrites a value.&lt;br/&gt;Returns the mutated collection.&lt;br/&gt;Defaults to an implementation in terms of &lt;tt&gt;find&lt;/tt&gt; and &lt;tt&gt;set&lt;/tt&gt;.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;retrieve&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Returns the contained value that is naturally equivalent to a given value.&lt;br/&gt;Throws a value error if none exists.&lt;br/&gt;Defaults to an implementation in terms of &lt;tt&gt;find&lt;/tt&gt; and &lt;tt&gt;get&lt;/tt&gt;.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;remove&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Removes a value.&lt;br/&gt;Throws a value error if the value isn't in the collection.&lt;br/&gt;Returns the mutated collection.&lt;br/&gt;Defaults to an implementation in terms of &lt;tt&gt;find&lt;/tt&gt; and &lt;tt&gt;del&lt;/tt&gt;.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;discard&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Removes a value if it exists.&lt;br/&gt;Returns the mutated collection.&lt;br/&gt;Implemented in terms of &lt;tt&gt;has&lt;/tt&gt; and &lt;tt&gt;remove&lt;/tt&gt;.&lt;/dd&gt;
	&lt;dt&gt;&lt;tt&gt;find&lt;/tt&gt;&lt;/dt&gt;&lt;dd&gt; Returns the key for a given value.&lt;br/&gt;Accepts an optional equivalence relation to override the default of &lt;tt&gt;eq&lt;/tt&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;Now accepting ideas for a good mnemonic.&lt;/p&gt;
&lt;p&gt;The fun trick is that &lt;tt&gt;List&lt;/tt&gt;, &lt;tt&gt;Dict&lt;/tt&gt;, and &lt;tt&gt;Set&lt;/tt&gt; implement all of these functions.  While it may be more appropriate to use one collection type for one kind of data or one algorithm, you can use any of these types interchangeably.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>You've heard of syntactic sugar.  After a syntax and vocabulary provides all of the normal forms necessary to express all of the programs possible in a language, yummy shortcuts bridge the gap between expressiveness and usability.  For example, <tt>c++</tt> is a delicious variation of <tt>(temp = c, c = c + 1, temp)</tt>.</p>
<p>You've also heard of CRUD, an acronym for the normal forms for a data programming interface (databases, data structures).  If you design an interface library for data and fail to cover all of these bases, you deserve what's coming to you&nbsp;&mdash;&nbsp;and I can't promise that it won't involve a big hole in the ground and Hello Kitty.</p>
<p>CRUD stands for <tt><u>c</u>reate</tt>, <tt><u>r</u>ead</tt>, <tt><u>u</u>pdate</tt>, and <tt><u>d</u>elete</tt>.  Those functions encompass all of the necessary data interactions; however, they are not sufficient.  While CRUD may provide all the nutrients, vitamins, and minerals your data API might need, it certainly won't taste good without sugar.</p>
<p><i>Enter: Chiron</i>.</p>
<p><tt><u>de</u>l, <u>s</u>et, <u>c</u>ut, <u>h</u>as, <u>pu</u>t, <u>get</u></tt>.  De Schpugeti.  All of these names are three letters long, should be familiar by their names, and are sufficient in addition to necessary.  These methods are the interface of Chiron's <tt>Dict</tt>, for manipulating item data: data that have keys and corresponding values.  They are also implemented in a consistent manner by <tt>List</tt> presuming that indices are like keys.</p>
<dl>
	<dt><tt>del</tt></dt><dd> Deletes an item for a key.<br/>Returns the mutated collection.<br/>For ordered collections, accepts a beginning key and an ending key, deleting all items in that range of keys excluding the ending key.<br/>Implemented in terms of <tt>remove</tt>.</dd>
	<dt><tt>set</tt></dt><dd> Adds or overwrites an item for a key.<br/>Returns the mutated collection.<br/>Implemented in terms of <tt>insert</tt>.</dd>
	<dt><tt>cut</tt></dt><dd> Deletes an item for a key.<br/>Throws a key error of no item has that key.<br/>Returns the corresponding value.<br/>Implemented in terms of <tt>get</tt> and <tt>del</tt>.</dd>
	<dt><tt>has</tt></dt><dd> Returns whether key is among items.<br/>Implemented in terms of <tt>has</tt>.</dd>
	<dt><tt>put</tt></dt><dd> Adds an item for a key.<br/>Throws a key error if there is already an item with that key.  returns the mutated collection.<br/>In an ordered collection, reserves the right to change the keys of some other items to make room for the new item.<br/>Implemented in terms of <tt>set</tt> and <tt>has</tt>.</dd>
	<dt><tt>get</tt></dt><dd> Returns a value for the given key.<br/>Throws a key error if there is no value for the given key.<br/>Implemented in terms of retrieve and <tt>has</tt>.</dd>
</dl>
<p>Also, <tt>List</tt>s, <tt>Set</tt>s, and, by extension, <tt>Dict</tt>s have functions for managing collections of values that do not have keys.  <tt>Dict</tt> is a <tt>Set</tt> of items instead of mere values that are compared and hashed on their key.</p>
<dl>
	<dt><tt>has</tt></dt><dd> Returns whether a collection contains a particular value.</dd>
	<dt><tt>insert</tt></dt><dd> Adds or overwrites a value.<br/>Returns the mutated collection.<br/>Defaults to an implementation in terms of <tt>find</tt> and <tt>set</tt>.</dd>
	<dt><tt>retrieve</tt></dt><dd> Returns the contained value that is naturally equivalent to a given value.<br/>Throws a value error if none exists.<br/>Defaults to an implementation in terms of <tt>find</tt> and <tt>get</tt>.</dd>
	<dt><tt>remove</tt></dt><dd> Removes a value.<br/>Throws a value error if the value isn't in the collection.<br/>Returns the mutated collection.<br/>Defaults to an implementation in terms of <tt>find</tt> and <tt>del</tt>.</dd>
	<dt><tt>discard</tt></dt><dd> Removes a value if it exists.<br/>Returns the mutated collection.<br/>Implemented in terms of <tt>has</tt> and <tt>remove</tt>.</dd>
	<dt><tt>find</tt></dt><dd> Returns the key for a given value.<br/>Accepts an optional equivalence relation to override the default of <tt>eq</tt>.</dd>
</dl>
<p>Now accepting ideas for a good mnemonic.</p>
<p>The fun trick is that <tt>List</tt>, <tt>Dict</tt>, and <tt>Set</tt> implement all of these functions.  While it may be more appropriate to use one collection type for one kind of data or one algorithm, you can use any of these types interchangeably.</p>
]]></content:encoded><category domain="http://cixar.com">program/javascript/chiron</category><dc:date>2008-03-25T00:51:59Z</dc:date></item><item><title>Caption Contest</title><guid isPermaLink="false">photo/404</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/photo/404</link><description>
&lt;p&gt;I found this gem around to corner from my current workplace:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/~kris/bdoc/photo/404.jpg&quot; title=&quot;404&quot;&gt;&lt;/p&gt;
&lt;p&gt;Please send me your submissions.&lt;/p&gt;
&lt;p&gt;(I say current because we're (&lt;a href=&quot;http://www.fastsoft.com/&quot;&gt;FastSoft&lt;/a&gt;) moving to Padadena at the end of this month.)&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>I found this gem around to corner from my current workplace:</p>
<p><img src="/~kris/bdoc/photo/404.jpg" title="404"></p>
<p>Please send me your submissions.</p>
<p>(I say current because we're (<a href="http://www.fastsoft.com/">FastSoft</a>) moving to Padadena at the end of this month.)</p>
]]></content:encoded><category domain="http://cixar.com">photo</category><dc:date>2008-03-20T23:00:01Z</dc:date></item><item><title>Unicode</title><guid isPermaLink="false">program/unicode</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/unicode</link><description>
&lt;p&gt;What I've learned today&amp;mdash;&lt;/p&gt;
&lt;p&gt;In order for a program or library to operate in a Unicode compatible fashion, all strings must be in Unicode.  All input strings must be brought into Unicode, and all output strings must be sent out of Unicode at the very last possible moment.  This is because, outside of Unicode strings, encoding is not a function of type and type information does not generally cross API boundaries accurately, plus regular expressions don't play well against mixed-length characters.&lt;/p&gt;
&lt;p&gt;Django works entirely in Unicode and drops a string to UTF-8 at the last moment.  I had need for Python's Textile library to transform text, but it only dealt with byte strings.  Anyhow, It turned out to be quick work to change all of its strings to unicode and not bother with encoding and decoding.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>What I've learned today&mdash;</p>
<p>In order for a program or library to operate in a Unicode compatible fashion, all strings must be in Unicode.  All input strings must be brought into Unicode, and all output strings must be sent out of Unicode at the very last possible moment.  This is because, outside of Unicode strings, encoding is not a function of type and type information does not generally cross API boundaries accurately, plus regular expressions don't play well against mixed-length characters.</p>
<p>Django works entirely in Unicode and drops a string to UTF-8 at the last moment.  I had need for Python's Textile library to transform text, but it only dealt with byte strings.  Anyhow, It turned out to be quick work to change all of its strings to unicode and not bother with encoding and decoding.</p>
]]></content:encoded><category domain="http://cixar.com">program</category><dc:date>2008-02-22T04:10:11Z</dc:date></item><item><title>Integrating Simile</title><guid isPermaLink="false">program/javascript/chiron/url</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/chiron/url</link><description>
&lt;p&gt;Not to name names, but I've been working on integrating code from &lt;a href=&quot;http://simile.mit.edu/&quot;&gt;Simile&lt;/a&gt; from MIT into &lt;a href=&quot;https://cixar.com/tracs/javascript&quot;&gt;Chiron&lt;/a&gt;.  Refactoring an existing JavaScript project highlights all the things you get for free in Chiron.&lt;/p&gt;
&lt;p&gt;Simile has it's own XHR engine, DOM event wrappers, DOM layout and style functions, PNG transparency solution, and a &lt;tt&gt;SortedArray&lt;/tt&gt; type that provides binary search functions.  Here are some of my observations.&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Simile's layout &lt;tt&gt;getSize&lt;/tt&gt; was better than mine.  I will rectify this.&lt;/li&gt;
	&lt;li&gt;Not having a module system makes us reinvent the wheel: frequently.&lt;/li&gt;
	&lt;li&gt;It's hard to write a good XHR engine.  There are a lot of XHR modules out there, most of them have some issue or another: missing browser, doesn't report OK status on local files, doesn't unify browser caching inconsistencies, doesn't support timeouts, doesn't expose XML (the X in AJAX) in IE, or so on.  If you're going to make a new one, you should use these as references and do some serious research, development, and testing.  Otherwise, you should copy or use the best of them (&lt;a href=&quot;http://jquery.com/&quot;&gt;jQuery&lt;/a&gt;, in my opinion).  Also, it needs to support asynchronous (the A in AJAX) requests, and you need to use them as often as possible.&lt;/li&gt;
	&lt;li&gt;Not having a solid, modular library makes us lazy.  The inconvenience of name-spacing makes us lazy.  This causes us to write sloppy code.  For example, we should always use an &lt;tt&gt;enquote&lt;/tt&gt; function when we're string interpolating HTML attributes and an &lt;tt&gt;inoculate&lt;/tt&gt; function when we're interpolating HTML, or we should use DOM functions or a DOM wrapper API to generate our HTML.&lt;/li&gt;
	&lt;li&gt;As I integrate code from other libraries, a pattern emerges.  In my first pass, I collapse the name-spaces.  Every module is a name-space, so all the manual creating of hierarchies like &lt;tt&gt;Simile.DOM&lt;/tt&gt; (&lt;tt&gt;Simile = {}&lt;/tt&gt; presumed, then &lt;tt&gt;Simile.DOM = {}&lt;/tt&gt;, then endless repetition of &lt;tt&gt;Simile.DOM&lt;/tt&gt; to augment or use its contents) is unnecessary and undesirable.&lt;/li&gt;
	&lt;p&gt;Referencing URL's of resources, like other scripts and images, relative to the URL of the script you're currently in, is hard.  Starting from scratch, this usually means you're going to have a global URL constant.  This means domain-coupling.  Maybe you make the URL relative to the root.  This means domain-coupling.  Maybe you provide it as a configuration variable.  This means site-coupling.  Maybe you scrape the script tags on the page for the URL of your script then resolve the URL relative to your own URL.  This means you're going to write a lot of slow code for what you perceive to be little value.  In Chiron, you can get a function called &lt;tt&gt;resolve&lt;/tt&gt; from &lt;tt&gt;http.js&lt;/tt&gt; that resolves a URL relative to a base URL.  Chiron also provides your modules with a &lt;tt&gt;moduleUrl&lt;/tt&gt; variable that is the URL of the script you're in.  &lt;tt&gt;resolve&lt;/tt&gt; also implicitly uses this variable as your base URL if you don't provide a second argument(&lt;tt&gt;include('http.js'); resolve('images/blah.gif')&lt;/tt&gt;).&lt;/p&gt;
	&lt;p&gt;Chiron grabs the script tag href of &lt;tt&gt;modules.js&lt;/tt&gt; and removes the &lt;tt&gt;script&lt;/tt&gt; object from the DOM (so other scripts can't sniff it) exactly once, since it needs that URL to resolve other module URL's.  From there, Chiron keeps track of where all of your modules are relative to it and provides that information to each module.&lt;/p&gt;
	&lt;li&gt;About &lt;tt&gt;SortedArray&lt;/tt&gt;:&lt;/li&gt;

	&lt;ul&gt;
		&lt;li&gt;A collection type should create an empty instance if you pass no arguments in.&lt;/li&gt;
		&lt;li&gt;A collection type should populate itself from the values of another collection if you pass one in as its first argument.  This should always be the first argument, even if you frequently create empty collections with overrides on later arguments.  Force your user to pass in a &lt;tt&gt;null&lt;/tt&gt; or &lt;tt&gt;undefined&lt;/tt&gt;.&lt;/li&gt;
		&lt;li&gt;Try to accept &lt;tt&gt;null&lt;/tt&gt; and &lt;tt&gt;undefined&lt;/tt&gt; as equivalent unless the distinction is meaningful.&lt;/li&gt;
		&lt;li&gt;Try to distinguish &lt;tt&gt;null&lt;/tt&gt; and &lt;tt&gt;undefined&lt;/tt&gt; from &lt;tt&gt;0&lt;/tt&gt; in all meaningful cases.&lt;/li&gt;
		&lt;li&gt;Invariants like &quot;sorted&quot; are a promise.  Guarantee your invariants across all function calls, including construction.  If this means an unacceptable performance degradation, permit the user to suppress whatever code you need to verify the invariant if they are willing to provide treated data.&lt;/li&gt;
		&lt;li&gt;If there is a reasonable default, it should always be implicit.  I should not have to explicitly send the global &lt;tt&gt;compare&lt;/tt&gt; function into a &lt;tt&gt;SortedArray&lt;/tt&gt; if I want a &lt;tt&gt;SortedArray&lt;/tt&gt; of types supported by &lt;tt&gt;compare&lt;/tt&gt;.&lt;/li&gt;
	&lt;/ul&gt;
	&lt;li&gt;Not having a system of base types makes for noisy API's where names from different organizations have different meanings.  For example, &lt;tt&gt;find&lt;/tt&gt; functions should always accept the same kinds of arguments and return the same kinds of values.  Simile's name choices are very close to mine, to the effect that they could almost be used as partially implemented duck types for mine, but some of the names would have to be realigned.  &lt;tt&gt;find&lt;/tt&gt; in Simile accepts a comparator and returns an acceptable index to insert or remove a particular element.  &lt;tt&gt;find&lt;/tt&gt; in Chiron returns an index or key at which an item can be inserted or removed, and guarantees that it will be the first occurrence of a given value (not a comparator).  It was very easy to refactor &lt;tt&gt;SortedArray&lt;/tt&gt; to subscribe to the strict model.  Also, &lt;tt&gt;removeAll&lt;/tt&gt; needed to be &lt;tt&gt;clear&lt;/tt&gt;, &lt;tt&gt;length&lt;/tt&gt; and &lt;tt&gt;getCount&lt;/tt&gt; both needed to be &lt;tt&gt;getLength&lt;/tt&gt;, &lt;tt&gt;getIterator&lt;/tt&gt; needed to be &lt;tt&gt;iter&lt;/tt&gt;, &lt;tt&gt;next&lt;/tt&gt; needed to throw &lt;tt&gt;StopIteration&lt;/tt&gt; once in a while, among others.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I'm looking forward to having a semblance of Simile Timeplot and Timechart in the Chiron family.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>Not to name names, but I've been working on integrating code from <a href="http://simile.mit.edu/">Simile</a> from MIT into <a href="https://cixar.com/tracs/javascript">Chiron</a>.  Refactoring an existing JavaScript project highlights all the things you get for free in Chiron.</p>
<p>Simile has it's own XHR engine, DOM event wrappers, DOM layout and style functions, PNG transparency solution, and a <tt>SortedArray</tt> type that provides binary search functions.  Here are some of my observations.</p>

<ul>
	<li>Simile's layout <tt>getSize</tt> was better than mine.  I will rectify this.</li>
	<li>Not having a module system makes us reinvent the wheel: frequently.</li>
	<li>It's hard to write a good XHR engine.  There are a lot of XHR modules out there, most of them have some issue or another: missing browser, doesn't report OK status on local files, doesn't unify browser caching inconsistencies, doesn't support timeouts, doesn't expose XML (the X in AJAX) in IE, or so on.  If you're going to make a new one, you should use these as references and do some serious research, development, and testing.  Otherwise, you should copy or use the best of them (<a href="http://jquery.com/">jQuery</a>, in my opinion).  Also, it needs to support asynchronous (the A in AJAX) requests, and you need to use them as often as possible.</li>
	<li>Not having a solid, modular library makes us lazy.  The inconvenience of name-spacing makes us lazy.  This causes us to write sloppy code.  For example, we should always use an <tt>enquote</tt> function when we're string interpolating HTML attributes and an <tt>inoculate</tt> function when we're interpolating HTML, or we should use DOM functions or a DOM wrapper API to generate our HTML.</li>
	<li>As I integrate code from other libraries, a pattern emerges.  In my first pass, I collapse the name-spaces.  Every module is a name-space, so all the manual creating of hierarchies like <tt>Simile.DOM</tt> (<tt>Simile = {}</tt> presumed, then <tt>Simile.DOM = {}</tt>, then endless repetition of <tt>Simile.DOM</tt> to augment or use its contents) is unnecessary and undesirable.</li>
	<p>Referencing URL's of resources, like other scripts and images, relative to the URL of the script you're currently in, is hard.  Starting from scratch, this usually means you're going to have a global URL constant.  This means domain-coupling.  Maybe you make the URL relative to the root.  This means domain-coupling.  Maybe you provide it as a configuration variable.  This means site-coupling.  Maybe you scrape the script tags on the page for the URL of your script then resolve the URL relative to your own URL.  This means you're going to write a lot of slow code for what you perceive to be little value.  In Chiron, you can get a function called <tt>resolve</tt> from <tt>http.js</tt> that resolves a URL relative to a base URL.  Chiron also provides your modules with a <tt>moduleUrl</tt> variable that is the URL of the script you're in.  <tt>resolve</tt> also implicitly uses this variable as your base URL if you don't provide a second argument(<tt>include('http.js'); resolve('images/blah.gif')</tt>).</p>
	<p>Chiron grabs the script tag href of <tt>modules.js</tt> and removes the <tt>script</tt> object from the DOM (so other scripts can't sniff it) exactly once, since it needs that URL to resolve other module URL's.  From there, Chiron keeps track of where all of your modules are relative to it and provides that information to each module.</p>
	<li>About <tt>SortedArray</tt>:</li>

	<ul>
		<li>A collection type should create an empty instance if you pass no arguments in.</li>
		<li>A collection type should populate itself from the values of another collection if you pass one in as its first argument.  This should always be the first argument, even if you frequently create empty collections with overrides on later arguments.  Force your user to pass in a <tt>null</tt> or <tt>undefined</tt>.</li>
		<li>Try to accept <tt>null</tt> and <tt>undefined</tt> as equivalent unless the distinction is meaningful.</li>
		<li>Try to distinguish <tt>null</tt> and <tt>undefined</tt> from <tt>0</tt> in all meaningful cases.</li>
		<li>Invariants like "sorted" are a promise.  Guarantee your invariants across all function calls, including construction.  If this means an unacceptable performance degradation, permit the user to suppress whatever code you need to verify the invariant if they are willing to provide treated data.</li>
		<li>If there is a reasonable default, it should always be implicit.  I should not have to explicitly send the global <tt>compare</tt> function into a <tt>SortedArray</tt> if I want a <tt>SortedArray</tt> of types supported by <tt>compare</tt>.</li>
	</ul>
	<li>Not having a system of base types makes for noisy API's where names from different organizations have different meanings.  For example, <tt>find</tt> functions should always accept the same kinds of arguments and return the same kinds of values.  Simile's name choices are very close to mine, to the effect that they could almost be used as partially implemented duck types for mine, but some of the names would have to be realigned.  <tt>find</tt> in Simile accepts a comparator and returns an acceptable index to insert or remove a particular element.  <tt>find</tt> in Chiron returns an index or key at which an item can be inserted or removed, and guarantees that it will be the first occurrence of a given value (not a comparator).  It was very easy to refactor <tt>SortedArray</tt> to subscribe to the strict model.  Also, <tt>removeAll</tt> needed to be <tt>clear</tt>, <tt>length</tt> and <tt>getCount</tt> both needed to be <tt>getLength</tt>, <tt>getIterator</tt> needed to be <tt>iter</tt>, <tt>next</tt> needed to throw <tt>StopIteration</tt> once in a while, among others.</li>
</ul>
<p>I'm looking forward to having a semblance of Simile Timeplot and Timechart in the Chiron family.</p>
]]></content:encoded><category domain="http://cixar.com">program/javascript/chiron</category><dc:date>2008-02-19T09:39:46Z</dc:date></item><item><title>Polymorphic &lt;tt&gt;repr&lt;/tt&gt;</title><guid isPermaLink="false">program/javascript/chiron/1</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/chiron/1</link><description>
&lt;p&gt;I'm not about to debate whether &lt;a href=&quot;http://ajaxian.com/archives/self-printing-javascript-literals&quot;&gt;debugging&lt;/a&gt; is a valuable exercise in JavaScript, nor whether introspection or reflection tools are useful, nor whether they would be especially helpful in a dynamic language.  Ruby has &lt;tt&gt;inspect&lt;/tt&gt;.  Python has &lt;tt&gt;repr&lt;/tt&gt;.  The Chiron JavaScript library has &lt;tt&gt;repr&lt;/tt&gt; too.&lt;/p&gt;
&lt;p&gt;Notionally, &lt;tt&gt;repr&lt;/tt&gt; is the inverse of &lt;tt&gt;eval&lt;/tt&gt; for a reasonable subset of JavaScript.  There are a lot of object hierarchies that cannot be reconstructed from a &lt;tt&gt;repr&lt;/tt&gt; serialization, but as a debugging tool, &lt;tt&gt;repr&lt;/tt&gt; is indispensable.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;repr&lt;/tt&gt; is a polymorphic function you can import from &lt;tt&gt;base.js&lt;/tt&gt;.  If you pass &lt;tt&gt;repr&lt;/tt&gt; an object that implements a &lt;tt&gt;repr&lt;/tt&gt; member function, &lt;tt&gt;repr&lt;/tt&gt; will defer to your overridable &lt;tt&gt;repr&lt;/tt&gt;.  Otherwise, &lt;tt&gt;repr&lt;/tt&gt; returns reasonable defaults for other types.  For example, &lt;tt&gt;repr&lt;/tt&gt; provides defaults for &lt;tt&gt;Array&lt;/tt&gt;, &lt;tt&gt;Object&lt;/tt&gt;, &lt;tt&gt;String&lt;/tt&gt;, &lt;tt&gt;Number&lt;/tt&gt;, &lt;tt&gt;Boolean&lt;/tt&gt;, and &lt;tt&gt;Date&lt;/tt&gt;.  &lt;tt&gt;repr&lt;/tt&gt; also recursively represents members of arrays and objects, but provides circular reference protection by tracking visited objects in a memo &lt;tt&gt;Set&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;Chiron's debugger uses &lt;tt&gt;repr&lt;/tt&gt; to convert the value of an expression on the command line to a human-readable string.&lt;/p&gt;

&lt;pre&gt;
&lt;b&gt;j$ 1&lt;/b&gt;
1
&lt;b&gt;j$ repr(1)&lt;/b&gt;
&quot;1&quot;
&lt;b&gt;j$ &quot;hi&quot;&lt;/b&gt;
&quot;hi&quot;
&lt;b&gt;j$ repr(&quot;hi&quot;)&lt;/b&gt;
&quot;\&quot;hi\&quot;&quot;
&lt;b&gt;j$ true&lt;/b&gt;
true
&lt;b&gt;j$ {a: 10}&lt;/b&gt;
{&quot;a&quot;: 10}
&lt;b&gt;j$ [1, 2, 3]&lt;/b&gt;
[1, 2, 3]
&lt;b&gt;j$ [{a: 10}]&lt;/b&gt;
[{&quot;a&quot;: 10}]
&lt;b&gt;j$ var a = {}; a.a = a; a&lt;/b&gt;
{&quot;a&quot;: &amp;lt;cycle&amp;gt;}
&lt;b&gt;j$ type()()&lt;/b&gt;
&amp;lt;instance run.html#0 0&amp;gt;
&lt;b&gt;j$ type({'repr': function () {return &quot;x&quot;}})()&lt;/b&gt;
x&lt;/pre&gt;
</description><content:encoded><![CDATA[
<p>I'm not about to debate whether <a href="http://ajaxian.com/archives/self-printing-javascript-literals">debugging</a> is a valuable exercise in JavaScript, nor whether introspection or reflection tools are useful, nor whether they would be especially helpful in a dynamic language.  Ruby has <tt>inspect</tt>.  Python has <tt>repr</tt>.  The Chiron JavaScript library has <tt>repr</tt> too.</p>
<p>Notionally, <tt>repr</tt> is the inverse of <tt>eval</tt> for a reasonable subset of JavaScript.  There are a lot of object hierarchies that cannot be reconstructed from a <tt>repr</tt> serialization, but as a debugging tool, <tt>repr</tt> is indispensable.</p>
<p><tt>repr</tt> is a polymorphic function you can import from <tt>base.js</tt>.  If you pass <tt>repr</tt> an object that implements a <tt>repr</tt> member function, <tt>repr</tt> will defer to your overridable <tt>repr</tt>.  Otherwise, <tt>repr</tt> returns reasonable defaults for other types.  For example, <tt>repr</tt> provides defaults for <tt>Array</tt>, <tt>Object</tt>, <tt>String</tt>, <tt>Number</tt>, <tt>Boolean</tt>, and <tt>Date</tt>.  <tt>repr</tt> also recursively represents members of arrays and objects, but provides circular reference protection by tracking visited objects in a memo <tt>Set</tt>.</p>
<p>Chiron's debugger uses <tt>repr</tt> to convert the value of an expression on the command line to a human-readable string.</p>

<pre>
<b>j$ 1</b>
1
<b>j$ repr(1)</b>
"1"
<b>j$ "hi"</b>
"hi"
<b>j$ repr("hi")</b>
"\"hi\""
<b>j$ true</b>
true
<b>j$ {a: 10}</b>
{"a": 10}
<b>j$ [1, 2, 3]</b>
[1, 2, 3]
<b>j$ [{a: 10}]</b>
[{"a": 10}]
<b>j$ var a = {}; a.a = a; a</b>
{"a": &lt;cycle&gt;}
<b>j$ type()()</b>
&lt;instance run.html#0 0&gt;
<b>j$ type({'repr': function () {return "x"}})()</b>
x</pre>
]]></content:encoded><category domain="http://cixar.com">program/javascript/chiron</category><dc:date>2008-02-18T20:19:37Z</dc:date></item><item><title>Tale Mailing List</title><guid isPermaLink="false">tale/2008-01-27</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/tale/2008-01-27</link><description>
&lt;p&gt;Please subscribe to Tale's &lt;a href=&quot;http://groups.google.com/group/cixar-tale&quot;&gt;mailing list&lt;/a&gt; if you are interested in joining the invitation alpha in July or the beta in November.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>Please subscribe to Tale's <a href="http://groups.google.com/group/cixar-tale">mailing list</a> if you are interested in joining the invitation alpha in July or the beta in November.</p>
]]></content:encoded><category domain="http://cixar.com">tale</category><dc:date>2008-01-28T08:26:49Z</dc:date></item><item><title>Some Handy Commands</title><guid isPermaLink="false">program/cli/2008-01-10</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/cli/2008-01-10</link><description>
&lt;p&gt;I've learned a few handy commands this year, so here's the wealth.&lt;/p&gt;
&lt;p&gt;Sets have always been a big hole in my command line toolkit.  I've gone to such lengths as to implement commands for basic set intersection and union in Perl or Python.  Go no farther!  While looking over &lt;a href=&quot;http://blog.joshlewis.org/&quot;&gt;Lasermacaroni&lt;/a&gt;'s shoulder about a year ago, I noticed that he used the &lt;tt&gt;comm&lt;/tt&gt; command.  &lt;tt&gt;comm&lt;/tt&gt; operates on sorted unique streams of lines and produces a three column output of which elements were in column A only, column B only, or both.  Of course, three columns are nearly useless, so you can tell &lt;tt&gt;comm&lt;/tt&gt; to suppress the output of certain columns.  Yes, this is stupid, but here's your mnemonic: ask not what columns comm can display for you, rather ask what columns you can suppress from comm.  Go!&lt;/p&gt;

&lt;pre&gt;
A &amp; B: comm -12 A B
A &amp; !B: comm -23 A B
!A &amp; B: comm -13 A B
A | B: cat A B | sort | uniq&lt;/pre&gt;
&lt;p&gt;Of course, I like to use &lt;tt&gt;comm&lt;/tt&gt; like &lt;tt&gt;grep&lt;/tt&gt; or &lt;tt&gt;grep -v&lt;/tt&gt; to find the elements from an input stream that either are or are not in a given file.  Mind that your file needs to be sorted and uniqued.&lt;/p&gt;

&lt;pre&gt;
also in A:  ... | sort | uniq | comm -12 - A
not in A:   ... | sort | uniq | comm -23 - A&lt;/pre&gt;
&lt;p&gt;I've known about the &lt;tt&gt;seq&lt;/tt&gt; command in Linux-land for a while.  It creates lists of numbers in a given range.&lt;/p&gt;

&lt;pre&gt;
seq &lt;i&gt;last&lt;/i&gt;
seq &lt;i&gt;first&lt;/i&gt; &lt;i&gt;last&lt;/i&gt;
seq &lt;i&gt;first&lt;/i&gt; &lt;i&gt;stride&lt;/i&gt; &lt;i&gt;last&lt;/i&gt;&lt;/pre&gt;
&lt;p&gt;For examples:&lt;/p&gt;

&lt;pre&gt;
&lt;b&gt;$ seq 3&lt;/b&gt;
1
2
3
&lt;b&gt;$ seq 3 5&lt;/b&gt;
3
4
5
&lt;b&gt;$ seq 0 2 4&lt;/b&gt;
0
2
4&lt;/pre&gt;
&lt;p&gt;I was quite disappointed not to find &lt;tt&gt;seq&lt;/tt&gt; on Mac OS X.  Turns out the BSD folks have a pretty bad case of &lt;a href=&quot;http://en.wikipedia.org/wiki/Not_Invented_Here&quot;&gt;NIH&lt;/a&gt;.  Instead of the &lt;tt&gt;seq&lt;/tt&gt; function, you may, having the good fortune of working around brilliant people every day, notice a friend, coworker, or other friendly mammal use the &lt;tt&gt;jot&lt;/tt&gt; command to produce their streams of numbers.&lt;/p&gt;

&lt;pre&gt;jot &lt;i&gt;[reps [begin [end [stride]]]]&lt;/i&gt;&lt;/pre&gt;
&lt;p&gt;Here are some occlusive examples:&lt;/p&gt;

&lt;pre&gt;
&lt;b&gt;$ jot 3&lt;/b&gt;
1
2
3
&lt;b&gt;$ jot 3 5&lt;/b&gt;
5
6
7
&lt;b&gt;% jot 3 0 6&lt;/b&gt;
0
3
6
&lt;b&gt;% jot 3 1 1&lt;/b&gt;
1
1
1
&lt;b&gt;jot -b+ -s- 40&lt;/b&gt;
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+&lt;/pre&gt;
&lt;p&gt;&lt;i&gt;fin&lt;/i&gt;&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>I've learned a few handy commands this year, so here's the wealth.</p>
<p>Sets have always been a big hole in my command line toolkit.  I've gone to such lengths as to implement commands for basic set intersection and union in Perl or Python.  Go no farther!  While looking over <a href="http://blog.joshlewis.org/">Lasermacaroni</a>'s shoulder about a year ago, I noticed that he used the <tt>comm</tt> command.  <tt>comm</tt> operates on sorted unique streams of lines and produces a three column output of which elements were in column A only, column B only, or both.  Of course, three columns are nearly useless, so you can tell <tt>comm</tt> to suppress the output of certain columns.  Yes, this is stupid, but here's your mnemonic: ask not what columns comm can display for you, rather ask what columns you can suppress from comm.  Go!</p>

<pre>
A & B: comm -12 A B
A & !B: comm -23 A B
!A & B: comm -13 A B
A | B: cat A B | sort | uniq</pre>
<p>Of course, I like to use <tt>comm</tt> like <tt>grep</tt> or <tt>grep -v</tt> to find the elements from an input stream that either are or are not in a given file.  Mind that your file needs to be sorted and uniqued.</p>

<pre>
also in A:  ... | sort | uniq | comm -12 - A
not in A:   ... | sort | uniq | comm -23 - A</pre>
<p>I've known about the <tt>seq</tt> command in Linux-land for a while.  It creates lists of numbers in a given range.</p>

<pre>
seq <i>last</i>
seq <i>first</i> <i>last</i>
seq <i>first</i> <i>stride</i> <i>last</i></pre>
<p>For examples:</p>

<pre>
<b>$ seq 3</b>
1
2
3
<b>$ seq 3 5</b>
3
4
5
<b>$ seq 0 2 4</b>
0
2
4</pre>
<p>I was quite disappointed not to find <tt>seq</tt> on Mac OS X.  Turns out the BSD folks have a pretty bad case of <a href="http://en.wikipedia.org/wiki/Not_Invented_Here">NIH</a>.  Instead of the <tt>seq</tt> function, you may, having the good fortune of working around brilliant people every day, notice a friend, coworker, or other friendly mammal use the <tt>jot</tt> command to produce their streams of numbers.</p>

<pre>jot <i>[reps [begin [end [stride]]]]</i></pre>
<p>Here are some occlusive examples:</p>

<pre>
<b>$ jot 3</b>
1
2
3
<b>$ jot 3 5</b>
5
6
7
<b>% jot 3 0 6</b>
0
3
6
<b>% jot 3 1 1</b>
1
1
1
<b>jot -b+ -s- 40</b>
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+</pre>
<p><i>fin</i></p>
]]></content:encoded><category domain="http://cixar.com">program/cli</category><dc:date>2008-01-11T06:57:52Z</dc:date></item><item><title>modules.js</title><guid isPermaLink="false">program/javascript/chiron/0</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/chiron/0</link><description>
&lt;p&gt;We've posted &lt;a href=&quot;http://modulesjs.com&quot;&gt;modulesjs.com&lt;/a&gt; this evening to proliferate what could be the most important piece of code I've ever written, &lt;tt&gt;modules.js&lt;/tt&gt;.  This JavaScript is the core of my Chiron JavaScript library project for the Tale game user interface, but could stand alone as the core of any number of JavaScript library projects.  Every popular JavaScript library could benefit from a module system that handles dependencies and isolates name spaces like Python or Ruby.  Read the &lt;a href=&quot;http://modulesjs.com/tutorial.html&quot;&gt;tutorial&lt;/a&gt; and look over the &lt;a href=&quot;http://cixar.com/tracs/javascript/browser/trunk/modules.js&quot;&gt;code&lt;/a&gt;.  Find me on an instant messenger or my face in the big blue box or send me an email and tell me what you think.&lt;/p&gt;
&lt;p&gt;Thanks go out to Ryan Witt for managing the server and domain, my sister Kathleen Kowal for the graphic design, Ryan Paul, Ryan Ernst, and Mike Stone for proofreading and particularly to Ryan Paul for letting me expound at him nigh daily for the last decade.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>We've posted <a href="http://modulesjs.com">modulesjs.com</a> this evening to proliferate what could be the most important piece of code I've ever written, <tt>modules.js</tt>.  This JavaScript is the core of my Chiron JavaScript library project for the Tale game user interface, but could stand alone as the core of any number of JavaScript library projects.  Every popular JavaScript library could benefit from a module system that handles dependencies and isolates name spaces like Python or Ruby.  Read the <a href="http://modulesjs.com/tutorial.html">tutorial</a> and look over the <a href="http://cixar.com/tracs/javascript/browser/trunk/modules.js">code</a>.  Find me on an instant messenger or my face in the big blue box or send me an email and tell me what you think.</p>
<p>Thanks go out to Ryan Witt for managing the server and domain, my sister Kathleen Kowal for the graphic design, Ryan Paul, Ryan Ernst, and Mike Stone for proofreading and particularly to Ryan Paul for letting me expound at him nigh daily for the last decade.</p>
]]></content:encoded><category domain="http://cixar.com">program/javascript/chiron</category><dc:date>2008-01-03T23:04:36Z</dc:date></item><item><title>New Year's Resolutions</title><guid isPermaLink="false">program/2008</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/2008</link><description>
&lt;p&gt;I don't generally make New Years resolutions.  But, since I'm a software engineer, and I've got some milestones to plot, I've decided to post a release schedule for my personal software projects.  This year, I'm going to release &lt;a href=&quot;http://cixar.com/tale&quot;&gt;Tale&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This involves continued development on &lt;a href=&quot;http://cixar.com/tracs/javascript&quot;&gt;Chiron&lt;/a&gt; JavaScript for the front-end, &lt;a href=&quot;http://cixar.com/tracs/ish&quot;&gt;Python on Planes&lt;/a&gt; for the back-end, and lots of new musical, graphical, and programmatic content.&lt;/p&gt;
&lt;p&gt;I'm of course still looking for volunteers (occasionally paid help, if I must and it's worth it) to develop various parts.  Chris Pasillas has been working on composing music for the game; we've got a lot of content and had a &lt;a href=&quot;http://cixar.com/~kris/tale/music/pasillas/meeting.mp3&quot;&gt;meeting [mp3]&lt;/a&gt; last week to develop creative direction.  However, if someone's equipped to render orchestrated versions of the music from the MIDI's (I've got Jonathan DeKlotz in mind for this, but he's a busy fellow too), that would be a super-awesome contribution.  We could also use some help from smart, creative, driven (perhaps by angst, anger, or escapism; whatever works for you) programmers who know or are eager to learn Python to develop the actual game engine logic and &quot;mob procs&quot;; this is a lot of work and the bulk of player experience, but I must admit that I'm only marginally interested in developing this aspect of the game, plus I've got a lot of work ahead of me to re-integrate PoP and Chiron.  I've had some help from Scott, and Josh &quot;Jynx&quot; Jenkins to develop the game math, plus some ideas of my own in the works, but someone who can dedicate programming time to make ideas real could have a big impact.  There are also a lot of Python and JavaScript mini-projects that I may or may not have time to develop myself with the remaining year of schedule, many of which would be very interesting, like intelligent narrative generation from event description trees, SVG sprite composition and rendering (partially implemented), much more 2d vector art for content, game state logic (making lots of use of Python generators if you want to learn about that), and much more.  Most of all, Tale needs volunteers who are willing to give a part of their soul, as I have, to the project.  Here's the development schedule.&lt;/p&gt;
&lt;p&gt;&lt;table&gt;
	&lt;tr&gt;&lt;th colspan=&quot;7&quot;&gt;January 2008&lt;/th&gt;&lt;/tr&gt;
	&lt;tr&gt;&lt;th width=&quot;14%&quot;&gt;Sun&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Mon&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Tue&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Wed&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Thu&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Fri&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Sat&lt;/th&gt;&lt;/tr&gt;	&lt;tr&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&lt;b&gt;1&lt;/b&gt;&lt;/td&gt;
		&lt;td&gt;2&lt;/td&gt;
		&lt;td&gt;3&lt;/td&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;5&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;6&lt;/td&gt;
		&lt;td&gt;7&lt;/td&gt;
		&lt;td&gt;8&lt;/td&gt;
		&lt;td&gt;9&lt;/td&gt;
		&lt;td&gt;10&lt;/td&gt;
		&lt;td&gt;11&lt;/td&gt;
		&lt;td&gt;12&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;13&lt;/td&gt;
		&lt;td&gt;14&lt;/td&gt;
		&lt;td&gt;15&lt;/td&gt;
		&lt;td&gt;16&lt;/td&gt;
		&lt;td&gt;17&lt;/td&gt;
		&lt;td&gt;18&lt;/td&gt;
		&lt;td&gt;19&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;20&lt;/td&gt;
		&lt;td&gt;21&lt;/td&gt;
		&lt;td&gt;22&lt;/td&gt;
		&lt;td&gt;23&lt;/td&gt;
		&lt;td&gt;24&lt;/td&gt;
		&lt;td&gt;25&lt;/td&gt;
		&lt;td&gt;26&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;27&lt;/td&gt;
		&lt;td&gt;28&lt;/td&gt;
		&lt;td&gt;29&lt;/td&gt;
		&lt;td&gt;30&lt;/td&gt;
		&lt;td&gt;31&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;th&gt;&lt;b&gt;1&lt;/b&gt;&lt;/th&gt;&lt;td colspan=6&gt;
			Post Chiron 0.1 (done)
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;&lt;th colspan=&quot;7&quot;&gt;February 2008&lt;/th&gt;&lt;/tr&gt;
	&lt;tr&gt;&lt;th width=&quot;14%&quot;&gt;Sun&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Mon&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Tue&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Wed&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Thu&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Fri&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Sat&lt;/th&gt;&lt;/tr&gt;	&lt;tr&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;1&lt;/td&gt;
		&lt;td&gt;&lt;b&gt;2&lt;/b&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;3&lt;/td&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;5&lt;/td&gt;
		&lt;td&gt;6&lt;/td&gt;
		&lt;td&gt;7&lt;/td&gt;
		&lt;td&gt;8&lt;/td&gt;
		&lt;td&gt;9&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;10&lt;/td&gt;
		&lt;td&gt;11&lt;/td&gt;
		&lt;td&gt;12&lt;/td&gt;
		&lt;td&gt;13&lt;/td&gt;
		&lt;td&gt;14&lt;/td&gt;
		&lt;td&gt;15&lt;/td&gt;
		&lt;td&gt;16&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;17&lt;/td&gt;
		&lt;td&gt;18&lt;/td&gt;
		&lt;td&gt;19&lt;/td&gt;
		&lt;td&gt;20&lt;/td&gt;
		&lt;td&gt;21&lt;/td&gt;
		&lt;td&gt;22&lt;/td&gt;
		&lt;td&gt;23&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;24&lt;/td&gt;
		&lt;td&gt;25&lt;/td&gt;
		&lt;td&gt;26&lt;/td&gt;
		&lt;td&gt;27&lt;/td&gt;
		&lt;td&gt;28&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;th&gt;&lt;b&gt;2&lt;/b&gt;&lt;/th&gt;&lt;td colspan=6&gt;
			Deploy Chiron Website
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;&lt;th colspan=&quot;7&quot;&gt;May 2008&lt;/th&gt;&lt;/tr&gt;
	&lt;tr&gt;&lt;th width=&quot;14%&quot;&gt;Sun&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Mon&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Tue&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Wed&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Thu&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Fri&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Sat&lt;/th&gt;&lt;/tr&gt;	&lt;tr&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;1&lt;/td&gt;
		&lt;td&gt;2&lt;/td&gt;
		&lt;td&gt;&lt;b&gt;3&lt;/b&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;5&lt;/td&gt;
		&lt;td&gt;6&lt;/td&gt;
		&lt;td&gt;7&lt;/td&gt;
		&lt;td&gt;8&lt;/td&gt;
		&lt;td&gt;9&lt;/td&gt;
		&lt;td&gt;10&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;11&lt;/td&gt;
		&lt;td&gt;12&lt;/td&gt;
		&lt;td&gt;13&lt;/td&gt;
		&lt;td&gt;14&lt;/td&gt;
		&lt;td&gt;15&lt;/td&gt;
		&lt;td&gt;16&lt;/td&gt;
		&lt;td&gt;17&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;18&lt;/td&gt;
		&lt;td&gt;19&lt;/td&gt;
		&lt;td&gt;20&lt;/td&gt;
		&lt;td&gt;21&lt;/td&gt;
		&lt;td&gt;22&lt;/td&gt;
		&lt;td&gt;23&lt;/td&gt;
		&lt;td&gt;24&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;25&lt;/td&gt;
		&lt;td&gt;26&lt;/td&gt;
		&lt;td&gt;27&lt;/td&gt;
		&lt;td&gt;28&lt;/td&gt;
		&lt;td&gt;29&lt;/td&gt;
		&lt;td&gt;30&lt;/td&gt;
		&lt;td&gt;31&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;th&gt;&lt;b&gt;3&lt;/b&gt;&lt;/th&gt;&lt;td colspan=6&gt;
			Post Python on Planes 0.1
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;&lt;th colspan=&quot;7&quot;&gt;June 2008&lt;/th&gt;&lt;/tr&gt;
	&lt;tr&gt;&lt;th width=&quot;14%&quot;&gt;Sun&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Mon&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Tue&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Wed&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Thu&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Fri&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Sat&lt;/th&gt;&lt;/tr&gt;	&lt;tr&gt;
		&lt;td&gt;&lt;b&gt;1&lt;/b&gt;&lt;/td&gt;
		&lt;td&gt;2&lt;/td&gt;
		&lt;td&gt;3&lt;/td&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;5&lt;/td&gt;
		&lt;td&gt;6&lt;/td&gt;
		&lt;td&gt;7&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;8&lt;/td&gt;
		&lt;td&gt;9&lt;/td&gt;
		&lt;td&gt;10&lt;/td&gt;
		&lt;td&gt;11&lt;/td&gt;
		&lt;td&gt;12&lt;/td&gt;
		&lt;td&gt;13&lt;/td&gt;
		&lt;td&gt;14&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;15&lt;/td&gt;
		&lt;td&gt;16&lt;/td&gt;
		&lt;td&gt;17&lt;/td&gt;
		&lt;td&gt;18&lt;/td&gt;
		&lt;td&gt;19&lt;/td&gt;
		&lt;td&gt;20&lt;/td&gt;
		&lt;td&gt;21&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;22&lt;/td&gt;
		&lt;td&gt;23&lt;/td&gt;
		&lt;td&gt;24&lt;/td&gt;
		&lt;td&gt;25&lt;/td&gt;
		&lt;td&gt;26&lt;/td&gt;
		&lt;td&gt;27&lt;/td&gt;
		&lt;td&gt;28&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;29&lt;/td&gt;
		&lt;td&gt;30&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;th&gt;&lt;b&gt;1&lt;/b&gt;&lt;/th&gt;&lt;td colspan=6&gt;
			Release Chiron 1.0
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;th&gt;&lt;b&gt;1&lt;/b&gt;&lt;/th&gt;&lt;td colspan=6&gt;
			Begin Tale Invitation Beta
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;&lt;th colspan=&quot;7&quot;&gt;December 2008&lt;/th&gt;&lt;/tr&gt;
	&lt;tr&gt;&lt;th width=&quot;14%&quot;&gt;Sun&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Mon&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Tue&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Wed&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Thu&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Fri&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Sat&lt;/th&gt;&lt;/tr&gt;	&lt;tr&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;1&lt;/td&gt;
		&lt;td&gt;2&lt;/td&gt;
		&lt;td&gt;3&lt;/td&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;&lt;b&gt;5&lt;/b&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;6&lt;/td&gt;
		&lt;td&gt;7&lt;/td&gt;
		&lt;td&gt;8&lt;/td&gt;
		&lt;td&gt;9&lt;/td&gt;
		&lt;td&gt;10&lt;/td&gt;
		&lt;td&gt;11&lt;/td&gt;
		&lt;td&gt;12&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;13&lt;/td&gt;
		&lt;td&gt;14&lt;/td&gt;
		&lt;td&gt;15&lt;/td&gt;
		&lt;td&gt;16&lt;/td&gt;
		&lt;td&gt;17&lt;/td&gt;
		&lt;td&gt;18&lt;/td&gt;
		&lt;td&gt;19&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;20&lt;/td&gt;
		&lt;td&gt;21&lt;/td&gt;
		&lt;td&gt;22&lt;/td&gt;
		&lt;td&gt;23&lt;/td&gt;
		&lt;td&gt;24&lt;/td&gt;
		&lt;td&gt;25&lt;/td&gt;
		&lt;td&gt;26&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;27&lt;/td&gt;
		&lt;td&gt;28&lt;/td&gt;
		&lt;td&gt;29&lt;/td&gt;
		&lt;td&gt;30&lt;/td&gt;
		&lt;td&gt;31&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;th&gt;&lt;b&gt;5&lt;/b&gt;&lt;/th&gt;&lt;td colspan=6&gt;
			Begin Tale Public Beta
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;&lt;th colspan=&quot;7&quot;&gt;January 2009&lt;/th&gt;&lt;/tr&gt;
	&lt;tr&gt;&lt;th width=&quot;14%&quot;&gt;Sun&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Mon&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Tue&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Wed&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Thu&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Fri&lt;/th&gt;&lt;th width=&quot;14%&quot;&gt;Sat&lt;/th&gt;&lt;/tr&gt;	&lt;tr&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&amp;nbsp;&lt;/td&gt;
		&lt;td&gt;&lt;b&gt;1&lt;/b&gt;&lt;/td&gt;
		&lt;td&gt;2&lt;/td&gt;
		&lt;td&gt;3&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;4&lt;/td&gt;
		&lt;td&gt;5&lt;/td&gt;
		&lt;td&gt;6&lt;/td&gt;
		&lt;td&gt;7&lt;/td&gt;
		&lt;td&gt;8&lt;/td&gt;
		&lt;td&gt;9&lt;/td&gt;
		&lt;td&gt;10&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;11&lt;/td&gt;
		&lt;td&gt;12&lt;/td&gt;
		&lt;td&gt;13&lt;/td&gt;
		&lt;td&gt;14&lt;/td&gt;
		&lt;td&gt;15&lt;/td&gt;
		&lt;td&gt;16&lt;/td&gt;
		&lt;td&gt;17&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;18&lt;/td&gt;
		&lt;td&gt;19&lt;/td&gt;
		&lt;td&gt;20&lt;/td&gt;
		&lt;td&gt;21&lt;/td&gt;
		&lt;td&gt;22&lt;/td&gt;
		&lt;td&gt;23&lt;/td&gt;
		&lt;td&gt;24&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;25&lt;/td&gt;
		&lt;td&gt;26&lt;/td&gt;
		&lt;td&gt;27&lt;/td&gt;
		&lt;td&gt;28&lt;/td&gt;
		&lt;td&gt;29&lt;/td&gt;
		&lt;td&gt;30&lt;/td&gt;
		&lt;td&gt;31&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;th&gt;&lt;b&gt;1&lt;/b&gt;&lt;/th&gt;&lt;td colspan=6&gt;
			Deploy Tale 1.0
		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/p&gt;
&lt;p&gt;This year will also mark another major step in the collision of my hobby-life and work-life.  I've never mentioned this in my personal blog, but I've been working at &lt;a href=&quot;http://www.apple.com/&quot;&gt;Apple&lt;/a&gt; for the last year and a half, but I'll be moving on to work for a start-up spun off of a networking lab at Caltech called &lt;a href=&quot;http://fastsoft.com/&quot;&gt;FastSoft&lt;/a&gt; where I will be developing the web user-interface for their Aria, a wide-area network performance optimizer.  This means I'll be much busier, and I'll be able to work on open-source projects like Chiron as part of my job.&lt;/p&gt;
&lt;p&gt;Looking back at all of my personal projects for the last eight years, a pattern emerges.  I want my code to help as many people as possible.  As for my motivations, as I realized over lunch with Ryan Witt and Christine Ortega over lunch last week, I'm an artist &amp;mdash; I'm performing for an audience and am gratified for appreciation of my creations.  I'm a fan of Reusability and Repurposability with big R's.  This has implications for the nature of the projects I find interesting.  I prefer to write libraries and languages: crystalline, orthogonal, refined, applicable, general, powerful, hosting usefulness through emergent patterns: uses unforeseen.  Reusability is also best served by proliferation, and what better way to proliferate a thing by making it valuable and free.  This isn't economics where value, cost, supply, and demand have interesting but vague relationships; I mean value as usefulness minus cost.  Also, what better way to make a thing valuable than to permit your users to exercise and refine it themselves and give them every reason in the world to share their contributions.  On a selfish note, I prefer to write software I can use anywhere, even if I'm working on something proprietary.  What I'm getting at here is Open Source, with a free, non-viral license.  I've chosen other licenses in the past for various purposes, withholding a piece of value for myself for money or the cause of freedom, but for the raw purposes of Reusability, Repurposability, proliferation, and the advancement of the state of the art, I've chosen to use a permissive, free, non-viral license.  So, my contributions to Chiron and PoP, at work and at home, will be available with the MIT license.&lt;/p&gt;
&lt;p&gt;Happy New Year; let's make.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>I don't generally make New Years resolutions.  But, since I'm a software engineer, and I've got some milestones to plot, I've decided to post a release schedule for my personal software projects.  This year, I'm going to release <a href="http://cixar.com/tale">Tale</a>.</p>
<p>This involves continued development on <a href="http://cixar.com/tracs/javascript">Chiron</a> JavaScript for the front-end, <a href="http://cixar.com/tracs/ish">Python on Planes</a> for the back-end, and lots of new musical, graphical, and programmatic content.</p>
<p>I'm of course still looking for volunteers (occasionally paid help, if I must and it's worth it) to develop various parts.  Chris Pasillas has been working on composing music for the game; we've got a lot of content and had a <a href="http://cixar.com/~kris/tale/music/pasillas/meeting.mp3">meeting [mp3]</a> last week to develop creative direction.  However, if someone's equipped to render orchestrated versions of the music from the MIDI's (I've got Jonathan DeKlotz in mind for this, but he's a busy fellow too), that would be a super-awesome contribution.  We could also use some help from smart, creative, driven (perhaps by angst, anger, or escapism; whatever works for you) programmers who know or are eager to learn Python to develop the actual game engine logic and "mob procs"; this is a lot of work and the bulk of player experience, but I must admit that I'm only marginally interested in developing this aspect of the game, plus I've got a lot of work ahead of me to re-integrate PoP and Chiron.  I've had some help from Scott, and Josh "Jynx" Jenkins to develop the game math, plus some ideas of my own in the works, but someone who can dedicate programming time to make ideas real could have a big impact.  There are also a lot of Python and JavaScript mini-projects that I may or may not have time to develop myself with the remaining year of schedule, many of which would be very interesting, like intelligent narrative generation from event description trees, SVG sprite composition and rendering (partially implemented), much more 2d vector art for content, game state logic (making lots of use of Python generators if you want to learn about that), and much more.  Most of all, Tale needs volunteers who are willing to give a part of their soul, as I have, to the project.  Here's the development schedule.</p>
<p><table>
	<tr><th colspan="7">January 2008</th></tr>
	<tr><th width="14%">Sun</th><th width="14%">Mon</th><th width="14%">Tue</th><th width="14%">Wed</th><th width="14%">Thu</th><th width="14%">Fri</th><th width="14%">Sat</th></tr>	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td><b>1</b></td>
		<td>2</td>
		<td>3</td>
		<td>4</td>
		<td>5</td>
	</tr>
	<tr>
		<td>6</td>
		<td>7</td>
		<td>8</td>
		<td>9</td>
		<td>10</td>
		<td>11</td>
		<td>12</td>
	</tr>
	<tr>
		<td>13</td>
		<td>14</td>
		<td>15</td>
		<td>16</td>
		<td>17</td>
		<td>18</td>
		<td>19</td>
	</tr>
	<tr>
		<td>20</td>
		<td>21</td>
		<td>22</td>
		<td>23</td>
		<td>24</td>
		<td>25</td>
		<td>26</td>
	</tr>
	<tr>
		<td>27</td>
		<td>28</td>
		<td>29</td>
		<td>30</td>
		<td>31</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<th><b>1</b></th><td colspan=6>
			Post Chiron 0.1 (done)
		</td>
	</tr>
	<tr><th colspan="7">February 2008</th></tr>
	<tr><th width="14%">Sun</th><th width="14%">Mon</th><th width="14%">Tue</th><th width="14%">Wed</th><th width="14%">Thu</th><th width="14%">Fri</th><th width="14%">Sat</th></tr>	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>1</td>
		<td><b>2</b></td>
	</tr>
	<tr>
		<td>3</td>
		<td>4</td>
		<td>5</td>
		<td>6</td>
		<td>7</td>
		<td>8</td>
		<td>9</td>
	</tr>
	<tr>
		<td>10</td>
		<td>11</td>
		<td>12</td>
		<td>13</td>
		<td>14</td>
		<td>15</td>
		<td>16</td>
	</tr>
	<tr>
		<td>17</td>
		<td>18</td>
		<td>19</td>
		<td>20</td>
		<td>21</td>
		<td>22</td>
		<td>23</td>
	</tr>
	<tr>
		<td>24</td>
		<td>25</td>
		<td>26</td>
		<td>27</td>
		<td>28</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<th><b>2</b></th><td colspan=6>
			Deploy Chiron Website
		</td>
	</tr>
	<tr><th colspan="7">May 2008</th></tr>
	<tr><th width="14%">Sun</th><th width="14%">Mon</th><th width="14%">Tue</th><th width="14%">Wed</th><th width="14%">Thu</th><th width="14%">Fri</th><th width="14%">Sat</th></tr>	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>1</td>
		<td>2</td>
		<td><b>3</b></td>
	</tr>
	<tr>
		<td>4</td>
		<td>5</td>
		<td>6</td>
		<td>7</td>
		<td>8</td>
		<td>9</td>
		<td>10</td>
	</tr>
	<tr>
		<td>11</td>
		<td>12</td>
		<td>13</td>
		<td>14</td>
		<td>15</td>
		<td>16</td>
		<td>17</td>
	</tr>
	<tr>
		<td>18</td>
		<td>19</td>
		<td>20</td>
		<td>21</td>
		<td>22</td>
		<td>23</td>
		<td>24</td>
	</tr>
	<tr>
		<td>25</td>
		<td>26</td>
		<td>27</td>
		<td>28</td>
		<td>29</td>
		<td>30</td>
		<td>31</td>
	</tr>
	<tr>
		<th><b>3</b></th><td colspan=6>
			Post Python on Planes 0.1
		</td>
	</tr>
	<tr><th colspan="7">June 2008</th></tr>
	<tr><th width="14%">Sun</th><th width="14%">Mon</th><th width="14%">Tue</th><th width="14%">Wed</th><th width="14%">Thu</th><th width="14%">Fri</th><th width="14%">Sat</th></tr>	<tr>
		<td><b>1</b></td>
		<td>2</td>
		<td>3</td>
		<td>4</td>
		<td>5</td>
		<td>6</td>
		<td>7</td>
	</tr>
	<tr>
		<td>8</td>
		<td>9</td>
		<td>10</td>
		<td>11</td>
		<td>12</td>
		<td>13</td>
		<td>14</td>
	</tr>
	<tr>
		<td>15</td>
		<td>16</td>
		<td>17</td>
		<td>18</td>
		<td>19</td>
		<td>20</td>
		<td>21</td>
	</tr>
	<tr>
		<td>22</td>
		<td>23</td>
		<td>24</td>
		<td>25</td>
		<td>26</td>
		<td>27</td>
		<td>28</td>
	</tr>
	<tr>
		<td>29</td>
		<td>30</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<th><b>1</b></th><td colspan=6>
			Release Chiron 1.0
		</td>
	</tr>
	<tr>
		<th><b>1</b></th><td colspan=6>
			Begin Tale Invitation Beta
		</td>
	</tr>
	<tr><th colspan="7">December 2008</th></tr>
	<tr><th width="14%">Sun</th><th width="14%">Mon</th><th width="14%">Tue</th><th width="14%">Wed</th><th width="14%">Thu</th><th width="14%">Fri</th><th width="14%">Sat</th></tr>	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>1</td>
		<td>2</td>
		<td>3</td>
		<td>4</td>
		<td><b>5</b></td>
	</tr>
	<tr>
		<td>6</td>
		<td>7</td>
		<td>8</td>
		<td>9</td>
		<td>10</td>
		<td>11</td>
		<td>12</td>
	</tr>
	<tr>
		<td>13</td>
		<td>14</td>
		<td>15</td>
		<td>16</td>
		<td>17</td>
		<td>18</td>
		<td>19</td>
	</tr>
	<tr>
		<td>20</td>
		<td>21</td>
		<td>22</td>
		<td>23</td>
		<td>24</td>
		<td>25</td>
		<td>26</td>
	</tr>
	<tr>
		<td>27</td>
		<td>28</td>
		<td>29</td>
		<td>30</td>
		<td>31</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<th><b>5</b></th><td colspan=6>
			Begin Tale Public Beta
		</td>
	</tr>
	<tr><th colspan="7">January 2009</th></tr>
	<tr><th width="14%">Sun</th><th width="14%">Mon</th><th width="14%">Tue</th><th width="14%">Wed</th><th width="14%">Thu</th><th width="14%">Fri</th><th width="14%">Sat</th></tr>	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td><b>1</b></td>
		<td>2</td>
		<td>3</td>
	</tr>
	<tr>
		<td>4</td>
		<td>5</td>
		<td>6</td>
		<td>7</td>
		<td>8</td>
		<td>9</td>
		<td>10</td>
	</tr>
	<tr>
		<td>11</td>
		<td>12</td>
		<td>13</td>
		<td>14</td>
		<td>15</td>
		<td>16</td>
		<td>17</td>
	</tr>
	<tr>
		<td>18</td>
		<td>19</td>
		<td>20</td>
		<td>21</td>
		<td>22</td>
		<td>23</td>
		<td>24</td>
	</tr>
	<tr>
		<td>25</td>
		<td>26</td>
		<td>27</td>
		<td>28</td>
		<td>29</td>
		<td>30</td>
		<td>31</td>
	</tr>
	<tr>
		<th><b>1</b></th><td colspan=6>
			Deploy Tale 1.0
		</td>
	</tr>
</table></p>
<p>This year will also mark another major step in the collision of my hobby-life and work-life.  I've never mentioned this in my personal blog, but I've been working at <a href="http://www.apple.com/">Apple</a> for the last year and a half, but I'll be moving on to work for a start-up spun off of a networking lab at Caltech called <a href="http://fastsoft.com/">FastSoft</a> where I will be developing the web user-interface for their Aria, a wide-area network performance optimizer.  This means I'll be much busier, and I'll be able to work on open-source projects like Chiron as part of my job.</p>
<p>Looking back at all of my personal projects for the last eight years, a pattern emerges.  I want my code to help as many people as possible.  As for my motivations, as I realized over lunch with Ryan Witt and Christine Ortega over lunch last week, I'm an artist &mdash; I'm performing for an audience and am gratified for appreciation of my creations.  I'm a fan of Reusability and Repurposability with big R's.  This has implications for the nature of the projects I find interesting.  I prefer to write libraries and languages: crystalline, orthogonal, refined, applicable, general, powerful, hosting usefulness through emergent patterns: uses unforeseen.  Reusability is also best served by proliferation, and what better way to proliferate a thing by making it valuable and free.  This isn't economics where value, cost, supply, and demand have interesting but vague relationships; I mean value as usefulness minus cost.  Also, what better way to make a thing valuable than to permit your users to exercise and refine it themselves and give them every reason in the world to share their contributions.  On a selfish note, I prefer to write software I can use anywhere, even if I'm working on something proprietary.  What I'm getting at here is Open Source, with a free, non-viral license.  I've chosen other licenses in the past for various purposes, withholding a piece of value for myself for money or the cause of freedom, but for the raw purposes of Reusability, Repurposability, proliferation, and the advancement of the state of the art, I've chosen to use a permissive, free, non-viral license.  So, my contributions to Chiron and PoP, at work and at home, will be available with the MIT license.</p>
<p>Happy New Year; let's make.</p>
]]></content:encoded><category domain="http://cixar.com">program</category><dc:date>2008-01-02T01:35:20Z</dc:date></item><item><title>Machina ex Deus</title><guid isPermaLink="false">program/tale/2007-06-18</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/tale/2007-06-18</link><description>
&lt;p&gt;Behold!&lt;/p&gt;
&lt;p&gt;&lt;center&gt;&lt;a href=&quot;http://cixar.com/tale/wiki/MachinaExDeus&quot;&gt;&lt;img src=&quot;https://cixar.com/tale/art/ride/machina-ex-deus-400.png&quot; title=&quot;Machina ex Deus&quot;/&gt;&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&quot;Do not be too proud of this technological terror you've constructed.&quot;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;- Lord Vader&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>Behold!</p>
<p><center><a href="http://cixar.com/tale/wiki/MachinaExDeus"><img src="https://cixar.com/tale/art/ride/machina-ex-deus-400.png" title="Machina ex Deus"/></a></center></p>
<p><i>"Do not be too proud of this technological terror you've constructed."</i></p>
<p>- Lord Vader</p>
]]></content:encoded><category domain="http://cixar.com">program/tale</category><dc:date>2007-06-18T07:00:00Z</dc:date></item><item><title>Cixar Tale Mailing List</title><guid isPermaLink="false">program/tale/2007-06-12</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/tale/2007-06-12</link><description>
&lt;p&gt;If you're interested in Tale development, please join the email discussion in our new &lt;a href=&quot;http://groups.google.com/group/cixar-tale&quot;&gt;Google group&lt;/a&gt;.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>If you're interested in Tale development, please join the email discussion in our new <a href="http://groups.google.com/group/cixar-tale">Google group</a>.</p>
]]></content:encoded><category domain="http://cixar.com">program/tale</category><dc:date>2007-06-12T07:00:00Z</dc:date></item><item><title>Tale Music</title><guid isPermaLink="false">program/tale/2007-05-13</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/tale/2007-05-13</link><description>
&lt;p&gt;It's also worth noting that I've commissioned Chris Pasillas, a friend from Cal Poly who studied Computer Engineering before getting his degree in Music with piano performance and composition.  Chris drafted at least one sketch for each of the faces of the &lt;a href=&quot;https://cixar.com/tale/wiki/TaleWorld&quot;&gt;Tale World&lt;/a&gt; this week.  The &lt;a href=&quot;http://cixar.com/tale/music/pasillas&quot;&gt;sketches&lt;/a&gt; are in the Tale &lt;a href=&quot;https://cixar.com/svns/tale/music&quot;&gt;Subversion repository&lt;/a&gt;.  Each sketch is denoted by a number and a name for each face and tension level.  Tension levels include &quot;town&quot;, &quot;adventure&quot;, and &quot;battle&quot;.  He's also working on a motif for each face.  Please send us your comments and suggestions.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>It's also worth noting that I've commissioned Chris Pasillas, a friend from Cal Poly who studied Computer Engineering before getting his degree in Music with piano performance and composition.  Chris drafted at least one sketch for each of the faces of the <a href="https://cixar.com/tale/wiki/TaleWorld">Tale World</a> this week.  The <a href="http://cixar.com/tale/music/pasillas">sketches</a> are in the Tale <a href="https://cixar.com/svns/tale/music">Subversion repository</a>.  Each sketch is denoted by a number and a name for each face and tension level.  Tension levels include "town", "adventure", and "battle".  He's also working on a motif for each face.  Please send us your comments and suggestions.</p>
]]></content:encoded><category domain="http://cixar.com">program/tale</category><dc:date>2007-05-13T07:00:00Z</dc:date></item><item><title>Chiron Automated Tests</title><guid isPermaLink="false">program/javascript/2007-05-13</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/2007-05-13</link><description>
&lt;p&gt;It's worth nothing that I've posted the current &lt;a href=&quot;/javascript/results.html&quot;&gt;results&lt;/a&gt; for automated unit testing for Javascript library.&lt;/p&gt;
&lt;p&gt;The automated test system uses a web browser, an &lt;a href=&quot;https://cixar.com/tracs/javascript/browser/bin/autoTestd&quot;&gt;HTTP daemon&lt;/a&gt;, a client web page, and a batch of javascript &lt;a href=&quot;https://cixar.com/tracs/javascript/browser/test&quot;&gt;unit test&lt;/a&gt; files.  A &lt;a href=&quot;https://cixar.com/tracs/javascript/browser/bin/autoTest&quot;&gt;script&lt;/a&gt; launches the daemon with an argument list containing a manifest of all of the javascript unit test files.  The daemon serves all of the Chiron files, a logger, a reporter, and a test file-name iterator.  The script then opens a web browser and navigates to the &lt;a href=&quot;https://cixar.com/tracs/javascript/browser/autoTest.html&quot;&gt;client page&lt;/a&gt;.  The client page supplants the usual &lt;a href=&quot;https://cixar.com/tracs/javascript/browser/test.js&quot;&gt;&lt;tt&gt;test.js&lt;/tt&gt;&lt;/a&gt; module with its own &lt;a href=&quot;https://cixar.com/tracs/javascript/browser/autoTest.js&quot;&gt;&lt;tt&gt;autoTest.js&lt;/tt&gt;&lt;/a&gt; module (in an aspect oriented fashion) so that the unit test assertions and timers get logged to the server via an HTTP request.  Then, the client page iteratively requests a test URL from the server and opens the test in a new window.  After all of the unit tests have run, the client opens the test results page.&lt;/p&gt;
&lt;p&gt;In the future, I would like to use up a database and leave the test daemon running before and after each Subversion commission so that test results can be gathered from a suite of platforms.  Then, there would be a catalog of performance and coverage trends.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>It's worth nothing that I've posted the current <a href="/javascript/results.html">results</a> for automated unit testing for Javascript library.</p>
<p>The automated test system uses a web browser, an <a href="https://cixar.com/tracs/javascript/browser/bin/autoTestd">HTTP daemon</a>, a client web page, and a batch of javascript <a href="https://cixar.com/tracs/javascript/browser/test">unit test</a> files.  A <a href="https://cixar.com/tracs/javascript/browser/bin/autoTest">script</a> launches the daemon with an argument list containing a manifest of all of the javascript unit test files.  The daemon serves all of the Chiron files, a logger, a reporter, and a test file-name iterator.  The script then opens a web browser and navigates to the <a href="https://cixar.com/tracs/javascript/browser/autoTest.html">client page</a>.  The client page supplants the usual <a href="https://cixar.com/tracs/javascript/browser/test.js"><tt>test.js</tt></a> module with its own <a href="https://cixar.com/tracs/javascript/browser/autoTest.js"><tt>autoTest.js</tt></a> module (in an aspect oriented fashion) so that the unit test assertions and timers get logged to the server via an HTTP request.  Then, the client page iteratively requests a test URL from the server and opens the test in a new window.  After all of the unit tests have run, the client opens the test results page.</p>
<p>In the future, I would like to use up a database and leave the test daemon running before and after each Subversion commission so that test results can be gathered from a suite of platforms.  Then, there would be a catalog of performance and coverage trends.</p>
]]></content:encoded><category domain="http://cixar.com">program/javascript</category><dc:date>2007-05-13T07:00:00Z</dc:date></item><item><title>Cixar Javascript Library and Names</title><guid isPermaLink="false">program/javascript/2007-05-12</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/2007-05-12</link><description>
&lt;p&gt;The name &quot;Cixar Javascript Library&quot;, or CJL, has numerous virtues.  It has a three letter acronym, a full name long enough to asphyxiate a cheetah, conjures absolutely no mental image, nor alludes to any works of art or literature.&lt;/p&gt;
&lt;p&gt;I'd like to announce that, having rigorously contemplated the issue from a vantage about two feet above my naval (that is, half of a meter for our dear friends huddled safely distant from the sanity interference field), I've decided to name the Cixar Javascript Library.  My requirements are succinct:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;one word,&lt;/li&gt;
	&lt;li&gt;allegorical, preferably ambiguous,&lt;/li&gt;
	&lt;li&gt;eminently brandable,&lt;/li&gt;
	&lt;li&gt;subtly humorous,&lt;/li&gt;
	&lt;li&gt;an alternate spelling in Unicode,&lt;/li&gt;
	&lt;li&gt;If possible, the name must enamour an attractive girl no more than five years older or younger than me before Monday.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I browsed Wikipedia and discovered Ajax's centaur tutor, &lt;i&gt;Chiron&lt;/i&gt;.  So, there you have it, the library's name is Chiron.  I leave it as an exercise for the reader and my fate/doom to discover whether it will suffice.  However, I will explicitly state that brandability is fulfilled.  Chiron, it turns out (back me up on this, Wikipedia), was really half-cow, the only Centauren to grace the Hellenic Pantheon.&lt;/p&gt;


&lt;hr&gt;
&lt;p&gt;For prospective users of Chiron, I have a question of nomenclature preference.  Use of the Chiron library requires the HTML author to include exactly one &lt;tt&gt;script&lt;/tt&gt; tag in their header, &lt;a href=&quot;/tracs/javascript/browser/modules.js&quot;&gt;modules.js&lt;/a&gt; (13KB shrunk but not compressed).  From there the author can opt to use whatever modules they will.&lt;/p&gt;
&lt;p&gt;Central to the Chiron library is a module currently called &lt;a href=&quot;/tracs/javascript/browser/javascript.js&quot;&gt;javascript.js&lt;/a&gt; that contains exceptions (&lt;tt&gt;KeyError&lt;/tt&gt;), the type system (&lt;tt&gt;type&lt;/tt&gt;), common types (&lt;tt&gt;Dict&lt;/tt&gt;, &lt;tt&gt;List&lt;/tt&gt;, &lt;tt&gt;Iter&lt;/tt&gt;), and a wealth of common functions (&lt;tt&gt;forEach&lt;/tt&gt;, &lt;tt&gt;stripEnd&lt;/tt&gt;) (currently 36KB shrunk but not compressed).  Since I would like to give the user the option of not loading this module, most modules explicitly include it, even though in a language like Python, these primitives would be  implicitly available.&lt;/p&gt;
&lt;p&gt;I called the module &lt;tt&gt;javascript.js&lt;/tt&gt; since it would include primitives that in Python would be part of the language.  In Python, this module would probably be called &lt;tt&gt;__builtins__.py&lt;/tt&gt;.  In any other Javascript library, precedent suggests that that module would be called &lt;tt&gt;base.js&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;Which of the following should I call this module of language primitives?&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;javascript.js&lt;/tt&gt;,&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;builtins.js&lt;/tt&gt;,&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;base.js&lt;/tt&gt;,&lt;/li&gt;
	&lt;li&gt;&lt;i&gt;your idea here&lt;/i&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Please send me an email and weigh in.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>The name "Cixar Javascript Library", or CJL, has numerous virtues.  It has a three letter acronym, a full name long enough to asphyxiate a cheetah, conjures absolutely no mental image, nor alludes to any works of art or literature.</p>
<p>I'd like to announce that, having rigorously contemplated the issue from a vantage about two feet above my naval (that is, half of a meter for our dear friends huddled safely distant from the sanity interference field), I've decided to name the Cixar Javascript Library.  My requirements are succinct:</p>

<ul>
	<li>one word,</li>
	<li>allegorical, preferably ambiguous,</li>
	<li>eminently brandable,</li>
	<li>subtly humorous,</li>
	<li>an alternate spelling in Unicode,</li>
	<li>If possible, the name must enamour an attractive girl no more than five years older or younger than me before Monday.</li>
</ul>
<p>I browsed Wikipedia and discovered Ajax's centaur tutor, <i>Chiron</i>.  So, there you have it, the library's name is Chiron.  I leave it as an exercise for the reader and my fate/doom to discover whether it will suffice.  However, I will explicitly state that brandability is fulfilled.  Chiron, it turns out (back me up on this, Wikipedia), was really half-cow, the only Centauren to grace the Hellenic Pantheon.</p>


<hr>
<p>For prospective users of Chiron, I have a question of nomenclature preference.  Use of the Chiron library requires the HTML author to include exactly one <tt>script</tt> tag in their header, <a href="/tracs/javascript/browser/modules.js">modules.js</a> (13KB shrunk but not compressed).  From there the author can opt to use whatever modules they will.</p>
<p>Central to the Chiron library is a module currently called <a href="/tracs/javascript/browser/javascript.js">javascript.js</a> that contains exceptions (<tt>KeyError</tt>), the type system (<tt>type</tt>), common types (<tt>Dict</tt>, <tt>List</tt>, <tt>Iter</tt>), and a wealth of common functions (<tt>forEach</tt>, <tt>stripEnd</tt>) (currently 36KB shrunk but not compressed).  Since I would like to give the user the option of not loading this module, most modules explicitly include it, even though in a language like Python, these primitives would be  implicitly available.</p>
<p>I called the module <tt>javascript.js</tt> since it would include primitives that in Python would be part of the language.  In Python, this module would probably be called <tt>__builtins__.py</tt>.  In any other Javascript library, precedent suggests that that module would be called <tt>base.js</tt>.</p>
<p>Which of the following should I call this module of language primitives?</p>

<ul>
	<li><tt>javascript.js</tt>,</li>
	<li><tt>builtins.js</tt>,</li>
	<li><tt>base.js</tt>,</li>
	<li><i>your idea here</i>.</li>
</ul>
<p>Please send me an email and weigh in.</p>
]]></content:encoded><category domain="http://cixar.com">program/javascript</category><dc:date>2007-05-12T07:00:00Z</dc:date></item><item><title>Javascript and Load Time</title><guid isPermaLink="false">program/javascript/2007-05-12-b</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/2007-05-12-b</link><description>
&lt;p&gt;I conducted a quick experiment to assess whether it is worth worrying about the size and distribution of Javascript modules.  I gathered the following numbers on my Linux box at home (fast) connected to Cixar (fast) over my home Internet connection (average today).&lt;/p&gt;

&lt;p&gt;&lt;table&gt;
	&lt;tr&gt;
		&lt;td&gt;
						ping cixar.com
		&lt;/td&gt;
		&lt;td colspan=2&gt;
						30ms
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
						ping google.com
		&lt;/td&gt;
		&lt;td colspan=2&gt;
						80ms
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
						HTTP overhead
		&lt;/td&gt;
		&lt;td colspan=2&gt;
						30ms
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
						bandwidth
		&lt;/td&gt;
		&lt;td colspan=2&gt;
						0.1KB/ms
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
						patience
		&lt;/td&gt;
		&lt;td colspan=2&gt;
						1500ms
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
						maximum size
		&lt;/td&gt;
		&lt;td colspan=2&gt;
						150KB
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
						Chiron core
		&lt;/td&gt;
		&lt;td colspan=2&gt;
						100KB
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
						Chiron core shrunk
		&lt;/td&gt;
		&lt;td colspan=2&gt;
						50KB
		&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr&gt;
		&lt;td&gt;
						Chiron core shrunk compressed
		&lt;/td&gt;
		&lt;td colspan=2&gt;
						13KB
		&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;&lt;/p&gt;
&lt;p&gt;I've decided not to worry about the size or distribution of Chiron until its core is five times bigger.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>I conducted a quick experiment to assess whether it is worth worrying about the size and distribution of Javascript modules.  I gathered the following numbers on my Linux box at home (fast) connected to Cixar (fast) over my home Internet connection (average today).</p>

<p><table>
	<tr>
		<td>
						ping cixar.com
		</td>
		<td colspan=2>
						30ms
		</td>
	</tr>
	<tr>
		<td>
						ping google.com
		</td>
		<td colspan=2>
						80ms
		</td>
	</tr>
	<tr>
		<td>
						HTTP overhead
		</td>
		<td colspan=2>
						30ms
		</td>
	</tr>
	<tr>
		<td>
						bandwidth
		</td>
		<td colspan=2>
						0.1KB/ms
		</td>
	</tr>
	<tr>
		<td>
						patience
		</td>
		<td colspan=2>
						1500ms
		</td>
	</tr>
	<tr>
		<td>
						maximum size
		</td>
		<td colspan=2>
						150KB
		</td>
	</tr>
	<tr>
		<td>
						Chiron core
		</td>
		<td colspan=2>
						100KB
		</td>
	</tr>
	<tr>
		<td>
						Chiron core shrunk
		</td>
		<td colspan=2>
						50KB
		</td>
	</tr>
	<tr>
		<td>
						Chiron core shrunk compressed
		</td>
		<td colspan=2>
						13KB
		</td>
	</tr>
</table></p>
<p>I've decided not to worry about the size or distribution of Chiron until its core is five times bigger.</p>
]]></content:encoded><category domain="http://cixar.com">program/javascript</category><dc:date>2007-05-12T07:00:00Z</dc:date></item><item><title>Higher Order Functions in Javascript</title><guid isPermaLink="false">program/javascript/2007-05-11</guid><link>http://cixar.com/~kris.kowal/cgi-bin/pyblosxom.cgi/program/javascript/2007-05-11</link><description>
&lt;p&gt;Recently I discovered that a friend of mine isn't using &quot;Higher Order Functions&quot; in &lt;a href=&quot;http://en.wikipedia.org/wiki/Gender-neutral_pronoun&quot;&gt;their&lt;/a&gt; Javascript.  I cried.  However, I fear, this is common-place, perhaps some artifact of a latent and ubiquitous fear of closures instilled by Internet Explorer and the folklore that arises in the absence of reliable, or believable, information.  In any case, I'm resolved to expound the virtues of this lesser known programming paradigm among object oriented language aficionados.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Higher-order_function&quot;&gt;Higher Order Functions&lt;/a&gt; are functions that accept or return functions.  This variety of insanity is possible in functional languages, or languages that provide &lt;a href=&quot;http://en.wikipedia.org/wiki/Closure_(computer_science)&quot;&gt;closures&lt;/a&gt;.  It is of course possible to accept and return function pointers in C or its ilk, but these are not sufficient for Higher Order Functions because you cannot create functions that can refer to the local variables of the function that instantiated them.  This is the crux.&lt;/p&gt;
&lt;p&gt;It is helpful to think of a name space as an &lt;tt&gt;Object&lt;/tt&gt;.  Calling a function creates a local name space, rooted in the name space in which the function is declared.  Unlike in assembly languages, these name spaces can persist, as &lt;tt&gt;Object&lt;/tt&gt;s do, long past the lifetime of the function call that created them.  Like &lt;tt&gt;Object&lt;/tt&gt;s, a name space exists as long as a reference exists referring to it.  However, among name spaces, the only way to refer to a name space is to create a name space rooted therein.  This means that the local variables of a function call exist as long as another function's name space refers to it.&lt;/p&gt;
&lt;p&gt;Permit me to offer a practical example, one that any one can use every day of the week.  Sort functions in most languages accept an optional comparator function as an argument.  C++'s &lt;a href=&quot;http://www.boost.org/&quot;&gt;Boost&lt;/a&gt; library for example &lt;a href=&quot;http://www.boost.org/libs/mpl/doc/refmanual/sort.html&quot;&gt;accepts predicates&lt;/a&gt;.  This is, of course, an insane hack since C++ isn't designed for functional fu.  Python provides &lt;tt&gt;sorted&lt;/tt&gt; and accepts a comparator.  You don't have to believe me; the important point is that Javascript &lt;a href=&quot;http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:sort&quot;&gt;follows suit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is the default &lt;tt&gt;sort&lt;/tt&gt; behavior.&lt;/p&gt;

&lt;pre&gt;
var items = [3, 1, 2];
items.sort();
assert(items == [1, 2, 3]);&lt;/pre&gt;
&lt;p&gt;A comparator is a function that accepts two arguments and returns an integer indicating whether the arguments are equivalent, sorted in ascending order or in descending order.  The result of a comparison call can be compared to 0 (on the right hand side of an expression) with &lt;tt&gt;==&lt;/tt&gt;, &lt;tt&gt;&amp;gt;&lt;/tt&gt; and &lt;tt&gt;&amp;lt;&lt;/tt&gt; and the result will be exactly the same as if the operands were replaced with the comparison arguments respectively.  So, if &lt;tt&gt;compare(a, b) == 0&lt;/tt&gt;, then &lt;tt&gt;a == b&lt;/tt&gt;, if &lt;tt&gt;compare(a, b) &amp;lt; 0&lt;/tt&gt; then &lt;tt&gt;a &amp;lt; b&lt;/tt&gt;.  The simplest &lt;tt&gt;compare&lt;/tt&gt; function provides these results for numbers.&lt;/p&gt;

&lt;pre&gt;
var compare = function (a, b) {
	return b - a;
}&lt;/pre&gt;
&lt;p&gt;This example, provides a reverse comparator; a comparator that will sort numbers in descending order.&lt;/p&gt;

&lt;pre&gt;
var compare = function (a, b) {
	return -(b - a);
};
var items = [3, 1, 2];
items.sort(compare);
assert(items == [3, 2, 1]);&lt;/pre&gt;
&lt;p&gt;Of course, there are all manner of objects that you might want to sort, and not all of them are strings and numbers.  Supposing you had an array of people, you might want to sort them by their last name.  You can do this with a comparator.&lt;/p&gt;

&lt;pre&gt;
var compare = function (a, b) {
	if (a.lastName b.lastName) {
		return -1;
	} else if (a.lastName == b.lastName) {
		return 0;
	} else {
		return 1;
	}
};
people.sort(compare);&lt;/pre&gt;
&lt;p&gt;Of course, it would be cumbersome to give highly descriptive names to every block of code you wrote and used once, so it's no more reasonable to have to name all of your comparators.  You can just use an anonymous function.&lt;/p&gt;

&lt;pre&gt;
people.sort(function (a, b) {
	if (a.lastName b.lastName) {
		return -1;
	} else if (a.lastName == b.lastName) {
		return 0;
	} else {
		return 1;
	}
});&lt;/pre&gt;
&lt;p&gt;However, you will find that all of your comparators will have the same shape.  They will probably all test equality and lessity.  It would be beneficial if you had a function that would create comparators for you just based on the attribute of the object you want to compare.  Enter higher order functions.  Let's construct one such function.&lt;/p&gt;
&lt;p&gt;We want to create a function that accepts two elements and returns a number reflecting their transitive relationship, a comparator, based on some attribute.  So, its clear that our function will &lt;i&gt;accept&lt;/i&gt; an attribute name, and return a function.&lt;/p&gt;

&lt;pre&gt;
/* the higher order function: */
var by = function (attribute) {
	/* the comparator: */
	return function (a, b) {
	};
};&lt;/pre&gt;
&lt;p&gt;Lets see the function in full.&lt;/p&gt;

&lt;pre&gt;
/* the higher order function: */
var by = function (attribute) {
	/* the comparator: */
	return function (a, b) {
		if (a[attribute] b[attribute]) {
			return -1;
		} else if (a[attribute] == b[attribute]) {
			return 0;
		} else {
			return 1;
		}
	};
};&lt;/pre&gt;
&lt;p&gt;The important leap here is that the comparator can refer to the &lt;tt&gt;attribute&lt;/tt&gt; from its enclosing name space, even though that function will have completed and been popped off the &quot;stack&quot; long before we ever call our comparator.&lt;/p&gt;
&lt;p&gt;We can use our mighty &lt;tt&gt;by&lt;/tt&gt; function to sort people by last name much more readably and succinctly.&lt;/p&gt;

&lt;pre&gt;people.sort(by('lastName'));&lt;/pre&gt;
&lt;p&gt;For good or ill, this will work for rigid arrays of arrays (tables) as well, if you provide an integer instead of an attribute name.  I say this with half of a heart because it's a Pyrrhic victory.  The price of being able to perform member selection and array indexing with the same, generic syntax is the inability to distinguish member selection for associative array (or hash) indexing, but that is a tale of woe for another day.&lt;/p&gt;

&lt;pre&gt;
var table = [
	['Kris', 'Kowal', 3],
	['Ryan', 'Paul', 2],
	['Ryan', 'Witt', 1]
];
table.sort(by(1));&lt;/pre&gt;
&lt;p&gt;In any case, this demonstrates the power of higher order functions in your every day life.  If you don't like the &lt;tt&gt;for (var i = 0; i length; i++)&lt;/tt&gt; pattern (as you ought be weary of by now), modern Javascript implementations provide a higher order function, &lt;tt&gt;Array.forEach&lt;/tt&gt;.  From the pantheon of functions you will also find &lt;tt&gt;map&lt;/tt&gt;, &lt;tt&gt;fold&lt;/tt&gt; or &lt;tt&gt;reduce&lt;/tt&gt;, &lt;tt&gt;filter&lt;/tt&gt;, &lt;tt&gt;compose&lt;/tt&gt;, &lt;tt&gt;partial&lt;/tt&gt;, and others.  Happy coding.&lt;/p&gt;
</description><content:encoded><![CDATA[
<p>Recently I discovered that a friend of mine isn't using "Higher Order Functions" in <a href="http://en.wikipedia.org/wiki/Gender-neutral_pronoun">their</a> Javascript.  I cried.  However, I fear, this is common-place, perhaps some artifact of a latent and ubiquitous fear of closures instilled by Internet Explorer and the folklore that arises in the absence of reliable, or believable, information.  In any case, I'm resolved to expound the virtues of this lesser known programming paradigm among object oriented language aficionados.</p>
<p><a href="http://en.wikipedia.org/wiki/Higher-order_function">Higher Order Functions</a> are functions that accept or return functions.  This variety of insanity is possible in functional languages, or languages that provide <a href="http://en.wikipedia.org/wiki/Closure_(computer_science)">closures</a>.  It is of course possible to accept and return function pointers in C or its ilk, but these are not sufficient for Higher Order Functions because you cannot create functions that can refer to the local variables of the function that instantiated them.  This is the crux.</p>
<p>It is helpful to think of a name space as an <tt>Object</tt>.  Calling a function creates a local name space, rooted in the name space in which the function is declared.  Unlike in assembly languages, these name spaces can persist, as <tt>Object</tt>s do, long past the lifetime of the function call that created them.  Like <tt>Object</tt>s, a name space exists as long as a reference exists referring to it.  However, among name spaces, the only way to refer to a name space is to create a name space rooted therein.  This means that the local variables of a function call exist as long as another function's name space refers to it.</p>
<p>Permit me to offer a practical example, one that any one can use every day of the week.  Sort functions in most languages accept an optional comparator function as an argument.  C++'s <a href="http://www.boost.org/">Boost</a> library for example <a href="http://www.boost.org/libs/mpl/doc/refmanual/sort.html">accepts predicates</a>.  This is, of course, an insane hack since C++ isn't designed for functional fu.  Python provides <tt>sorted</tt> and accepts a comparator.  You don't have to believe me; the important point is that Javascript <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:sort">follows suit</a>.</p>
<p>This is the default <tt>sort</tt> behavior.</p>

<pre>
var items = [3, 1, 2];
items.sort();
assert(items == [1, 2, 3]);</pre>
<p>A comparator is a function that accepts two arguments and returns an integer indicating whether the arguments are equivalent, sorted in ascending order or in descending order.  The result of a comparison call can be compared to 0 (on the right hand side of an expression) with <tt>==</tt>, <tt>&gt;</tt> and <tt>&lt;</tt> and the result will be exactly the same as if the operands were replaced with the comparison arguments respectively.  So, if <tt>compare(a, b) == 0</tt>, then <tt>a == b</tt>, if <tt>compare(a, b) &lt; 0</tt> then <tt>a &lt; b</tt>.  The simplest <tt>compare</tt> function provides these results for numbers.</p>

<pre>
var compare = function (a, b) {
	return b - a;
}</pre>
<p>This example, provides a reverse comparator; a comparator that will sort numbers in descending order.</p>

<pre>
var compare = function (a, b) {
	return -(b - a);
};
var items = [3, 1, 2];
items.sort(compare);
assert(items == [3, 2, 1]);</pre>
<p>Of course, there are all manner of objects that you might want to sort, and not all of them are strings and numbers.  Supposing you had an array of people, you might want to sort them by their last name.  You can do this with a comparator.</p>

<pre>
var compare = function (a, b) {
	if (a.lastName b.lastName) {
		return -1;
	} else if (a.lastName == b.lastName) {
		return 0;
	} else {
		return 1;
	}
};
people.sort(compare);</pre>
<p>Of course, it would be cumbersome to give highly descriptive names to every block of code you wrote and used once, so it's no more reasonable to have to name all of your comparators.  You can just use an anonymous function.</p>

<pre>
people.sort(function (a, b) {
	if (a.lastName b.lastName) {
		return -1;
	} else if (a.lastName == b.lastName) {
		return 0;
	} else {
		return 1;
	}
});</pre>
<p>However, you will find that all of your comparators will have the same shape.  They will probably all test equality and lessity.  It would be beneficial if you had a function that would create comparators for you just based on the attribute of the object you want to compare.  Enter higher order functions.  Let's construct one such function.</p>
<p>We want to create a funct