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

<channel>
	<title>Blog &#124; Rubyyot &#187; Ioke</title>
	<atom:link href="http://blog.rubyyot.com/category/programming/ioke-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rubyyot.com</link>
	<description>Programming, Pragmatism and Getting By in the World</description>
	<lastBuildDate>Wed, 24 Mar 2010 00:14:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting started with ISpec and Ioke &#8211; part 4</title>
		<link>http://blog.rubyyot.com/2009/06/getting-started-with-ispec-and-ioke-part-4/</link>
		<comments>http://blog.rubyyot.com/2009/06/getting-started-with-ispec-and-ioke-part-4/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 05:53:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ioke]]></category>
		<category><![CDATA[ispec]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=674</guid>
		<description><![CDATA[Part 4
This is part 4 of the increasingly mis-named Getting started with Ispec and Ioke trilogy.  Last time we discussed the let keyword and I started working on the template object which represented the template to be parsed into a document.
 Previously I used ISpec to assert that we could evaluate on cells on [...]]]></description>
			<content:encoded><![CDATA[<h3>Part 4</h3>
<p>This is part 4 of the increasingly mis-named <em><a href="http://blog.rubyyot.com/getting-started-with-ispec-and-ioke/">Getting started with Ispec and Ioke trilogy</a></em>.  Last time we discussed the let keyword and I started working on the template object which represented the template to be parsed into a document.</p>
<p> Previously I used ISpec to assert that we could evaluate on cells on Bag.  I wanted to start off this time by proving to myself that I could just as easily use activatable cells on Bag as well.</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">    it(&quot;should evaluate method on bag&quot;,
      bag = Bag mimic
      bag bread = method(&quot;butter&quot;)
      evaluator = Evaluator mimic(bag)
      evaluator evaluate(bread) should == &quot;butter&quot;
    )</pre></div></div>

<p>As you can see, this time instead of assigning a string to a cell on the property bag an evaluating it, I instead assigned a method which returned a string to a cell and evaluated it.  Sure enough it worked without any changes to the code.  This creates some interesting possibilities, though I haven&#8217;t thought through all of the ramifications at the moment. </p>
<p>Sure enough it worked.</p>
<p>Next I wanted to push the envelope on Evaluator a little bit by defining the method which will do the work of parsing the template and injecting the values from the property bag into it.</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">describe(&quot;parsing&quot;,
    it(&quot;should return the template when the bag is nil&quot;,
      evaluator = Evaluator mimic(nil)
      template = Template mimic
      template text = &quot;An extra special template&quot;
&nbsp;
      document = evaluator combine(template)
      document should == &quot;An extra special template&quot;
    )
  )</pre></div></div>

<p>This is really a small step, and as I get more familiar with TDD and BDD, these seem to the the steps that I&#8217;m most comforable with lining up and knocking down when implementing new features. The other part of this is, doing the simplest thing that could possibly work to pass the spec / test.  In this case, this is the simplest thing.</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">Evaluator combine = method (
  &quot;Generates a document from a template and bag&quot;,
&nbsp;
  template,
  template text
)</pre></div></div>

<p>
From here, I think that the next step is going involve using Ioke&#8217;s implementation of Regexp, which I will need to read up on.  So I think I will cut this short for today and wait for next time for that topic.
</p>
<h3>The Code</h3>
<p>The code for this example is <a href="http://github.com/rubyyot/ioke-examples/tree/start_ispec_4" title="rubyyot at Github ioke-examples tag start_ispec_4" target="_blank" rel="me">available on github tagged as start_ispec_4</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/06/getting-started-with-ispec-and-ioke-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with ISpec and Ioke &#8211; part 3</title>
		<link>http://blog.rubyyot.com/2009/06/getting-started-with-ispec-and-ioke-part-3/</link>
		<comments>http://blog.rubyyot.com/2009/06/getting-started-with-ispec-and-ioke-part-3/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 05:04:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ioke]]></category>
		<category><![CDATA[ispec]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=591</guid>
		<description><![CDATA[Ruby, not that there&#8217;s anything wrong with that
A little while ago, I issued my Summer of Learning Challenge.  As a suggestion,  Ioke would be a great thing to learn for those that would like to learn something this summer, but aren&#8217;t sure what to learn.  My project for the challenge is Ruby [...]]]></description>
			<content:encoded><![CDATA[<h3>Ruby, not that there&#8217;s anything wrong with that</h3>
<p>A little while ago, I issued my <a href="http://blog.rubyyot.com/2009/05/summer-of-learning-challenge/" title="My Summer of Learning Challenge" target="_blank" rel="me">Summer of Learning Challenge</a>.  As a suggestion,  Ioke would be a great thing to learn for those that would like to learn something this summer, but aren&#8217;t sure what to learn.  My project for the challenge is Ruby based, though I have a goal for the year to learn Ioke.  As you can see from <a href="http://calendaraboutnothing.com/~rubyyot" title="Seinfeld Calendar" target="_blank" rel="me">my Calendar About Nothing</a>, which currently has a 15 day string of commits, I&#8217;ve been busily plugging away at both. </p>
<p>A few days back, <a href="http://sam.aaron.name/" title="Sam Aaron" target=_blank">Sam Aaron</a> stopped by and commented on <a href="http://blog.rubyyot.com/2009/05/getting-started-with-ispec-and-ioke-part-2" title="Seinfeld Calendar" target="_blank" rel="me">part 2</a> of this series, pointing out an error with my code.</p>
<h3>Oops</h3>
<p>Well, there were two errors there. First my spec stated that Bag should evaluate nil as an empty string, but code specified that it should be nil.  Secondly, I had a problem with the way I had constructed my message chain so that my spec was evaluating nil should == nil.  Of course this will always evaluate to true.  I patched it up with the help of some advice in the comments.  In the future I&#8217;ll need to remember to be more explicit in my intent by remembering to use parens when passing parameters to methods so that they aren&#8217;t interpreted as part of the message chain.</p>
<p>My initial solution, which I updated to the post, was to monkeypatch bag so that the cell nil returned an empty string.  This solution didn&#8217;t really set well with me, but it passed the spec so I stuck with it.  After some rest, I remembered reading about the keyword <em>let</em>.</p>
<h3>The joy of let</h3>
<p>I wasn&#8217;t familiar with the let method from the other languages I use, which are primarily Ruby and C#.  But a little research showed that it provided an alternate solution to the specification.  Opening up the <a href="http://github.com/olabini/ioke/blob/87e67975b9bb30a00dbef97b72088e7e4fb9f12a/test/let_spec.ik" title="let spec" target="_blank" rel="ioke">specification for let</a>, you will see that it accepts zero or more comma separated name value pairs and a block of code.  It will then create a new temporary scope where the name is assigned the value and the code block is evaluated.  At the end of the execution of the code block, the scope goes away and everything returns to normal.  </p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">Evaluator = Origin mimic
&nbsp;
Evaluator initialize = method (
  &quot;Pass the property bag into the evaluator, this will be used for future evaluations.&quot;,
&nbsp;
  bag,
  @bag = bag
)
&nbsp;
Evaluator evaluate = macro (
  &quot;Takes the supplied message and evaluates it on the property bag. If nil is passed, it will return an empty string&quot;,
&nbsp;
  msg = call arguments first
  let(bag nil, &quot;&quot;,
    msg evaluateOn(bag)
  )
)</pre></div></div>

<p>This is an interesting alternative. It provides a way to temporarily modify an object while ensuring that your modifications don&#8217;t touch anything else once you are done.</p>
<h3>Variations on a theme</h3>
<p>One thing that I found particularly interesting is that all of the following variations seem to work</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">  let(@bag nil, &quot;&quot;,
    msg evaluateOn(bag)
  )</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">  let(bag nil, &quot;&quot;,
    msg evaluateOn(@bag)
  )</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">  let(Bag nil, &quot;&quot;,
    msg evaluateOn(bag)
  )</pre></div></div>

<p> I assume that the first two versions work because the sigil version of bag (@bag) simply points to the instance stored in the cell bag on the evaluator object.  In other words, when using Evaluator as ground, from inside the object, bag and @bag have the same meaning.  I&#8217;ll need to look into this to see if what I suspect is true. </p>
<p>I think that the third variation works because bag mimics Bag and so changes to Bag cascade to bag.  If it is true that modifications to the parent object made after the mimic has been made will cascade to all mimics, then that is a very powerful and easily abused feature of Ioke.  Again these are speculation on my part, and I will need to look into the truth of the matter. </p>
<h3>Starting Templates</h3>
<p>Once I had that figured out I started thinking of the next specification to tackle.  I decided that if I&#8217;m going to be able to use Ioke, I&#8217;d need to figure out how to work with files.  I feared that working with files might have been left out of the Ioke implementation as it is a very young language.  As it turns out, I was dead wrong.  The FileSystem object is implemented and quite easy to use.</p>
<h3>Ioke and the FileSystem</h3>
<p>I was quite happy to find a spec for the <a href="http://github.com/olabini/ioke/blob/87e67975b9bb30a00dbef97b72088e7e4fb9f12a/test/file_system_spec.ik" title="FileSystem spec" target="_blank">FileSystem</a> so that I could get a feel for it.  It turns out that there are a number of useful methods available and it appears to have support for Windows filesystems as well.</p>
<p>I decided to have my template object check to see if the string passed to it is a valid file.  If it is, it will load it.  If not, it will assume that the string passed to it is the template text.  I made it this way for testing purposes more than anything, and may change it around if it causes issues.  But it was simple to setup and it works.</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">&nbsp;
Template = Origin mimic
&nbsp;
Template load = method(&quot;load will load a template file.&quot;,
&nbsp;
  template,
  if(FileSystem exists?(template),
    Template text = FileSystem readFully(template),
    Template text = template
  )
)</pre></div></div>

<h3>The Code</h3>
<p>Current source snapshot is available on github tagged as <a href="http://github.com/rubyyot/ioke-examples/tree/start_ispec_3" title="Source" target="_blank"  rel="me">start_ispec_3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/06/getting-started-with-ispec-and-ioke-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with ISpec and Ioke &#8211; Part 2</title>
		<link>http://blog.rubyyot.com/2009/05/getting-started-with-ispec-and-ioke-part-2/</link>
		<comments>http://blog.rubyyot.com/2009/05/getting-started-with-ispec-and-ioke-part-2/#comments</comments>
		<pubDate>Sun, 17 May 2009 22:58:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ioke]]></category>
		<category><![CDATA[ispec]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=525</guid>
		<description><![CDATA[What I&#8217;m trying to make
I was recently reading a post on  using Ioke&#8217;s web kit, IKanServe, on Google&#8217;s App Engine.  It comes with a built-in HtmlBuilder object, but I wanted to try making something more like a rudimentary erb.  Basically a way to embed code in template files.

Evaluating on the property bag [...]]]></description>
			<content:encoded><![CDATA[<h2>What I&#8217;m trying to make</h2>
<p>I was recently reading a post on <a href="http://blog.hendrikvolkmer.de/2009/4/8/running-ikanserve-on-google-app-engine/" title="Running IKanServe on Google App Engine" target="_blank"> using Ioke&#8217;s web kit, IKanServe, on Google&#8217;s App Engine.</a>  It comes with <a href="http://olabini.com/blog/2009/03/ikanserve-an-ioke-web-framework/" title="IKanServe" target="_blank">a built-in HtmlBuilder object</a>, but I wanted to try making something more like a rudimentary erb.  Basically a way to embed code in template files.
</p>
<h2>Evaluating on the property bag </h2>
<p>So far I have created a basic property bag, which is really just a basic Ioke Object. At it does is serve as a portable ground on which to evaluate messages on. Next there is the Evaluator which takes a bag when it&#8217;s initialized and evaluates messages against it, returning the results.
</p>
<h2>Don&#8217;t be put off by Ioke&#8217;s advanced features, it&#8217;s quite usable</h2>
<p>
When I first thought using this as an example, this was as far as I got. I figured that If I could get to the point where I could have a parameter object that could be be evaluated against from another context, I would probably have put in a siginificant amount of work for a basic example and I could wrap it up call it a day and try using it with IKanServe.  Well as it turns out it wasn&#8217;t all that difficult to do. Really it was quite simple.  I updated my <em>test/evaluator_spec.ik</em> to read:</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">use(&quot;test/helper&quot;)
use(&quot;evaluator&quot;)
use(&quot;bag&quot;)
&nbsp;
describe(&quot;Evaluator&quot;,
  it(&quot;should have the correct kind&quot;,
    Evaluator kind should == &quot;Evaluator&quot;
  )
&nbsp;
  it(&quot;should have accept a bag on initialization&quot;,
    bag = Bag mimic
    bag foo = &quot;bar&quot;
    evaluator = Evaluator mimic (bag)
    evaluator bag foo should == &quot;bar&quot;
  )
&nbsp;
  describe(&quot;Evaluation&quot;,
    it(&quot;should evaluate nil as an empty string&quot;,
      bag = Bag mimic
      evaluator = Evaluator mimic(bag)
      evaluator evaluate(nil) should == &quot;&quot;
    )
&nbsp;
    it(&quot;should evaluate string on bag&quot;,
      bag = Bag mimic
      bag foo = &quot;wuzzle&quot;
      evaluator = Evaluator mimic (bag)
      evaluator evaluate(foo) should == &quot;wuzzle&quot;
    )
  )
)</pre></div></div>

<p>Looking at it now, the last spec should read &#8220;should evaluate message on bag&#8221; but you get the idea. At this point, I set out to implement this spec.
</p>
<h2>Don&#8217;t forget commas</h2>
<p>
My biggest problem by far was of my own design, and my own fault. When I first typed up the spec I left off the comma at the end of
</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">    it(&quot;should evaluate nil as an empty string&quot;,</pre></div></div>

<p>
This caused the compiler to output a not so pretty error message, that that took me quite some time to track down.  You see, I was sure that the issue was with my implementation of Evaluator rather than a syntax error in my spec.  So, if you are getting an error that says that it can&#8217;t import your spec, look for syntax errors there first.  You might be missing a comma.
</p>
<h2>Principle of least surprise</h2>
<p>One of the things I really enjoy about Ruby is that it subscribes to the principle of least surprise.  That is, if you don&#8217;t know the syntax for something, there is a good chance you will find it by trying the syntax that would make sense to you.  I think that this is a side effect (or not so side-effecty) of what Ola Bini recently termed <a href="http://olabini.com/blog/2009/05/the-ioke-philosophy/" title="Syntax over Explicit APIs" target="_blank">Syntax over Explicit APIs</a> in the Ioke Philosophy.
</p>
<p>
In any case, the code to pass the spec was simply:</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">Evaluator = Origin mimic
&nbsp;
Evaluator initialize = method (
  &quot;Pass the property bag into the evaluator, this will be used for future evaluations.&quot;,
  bag,
  @bag = bag
)
&nbsp;
Evaluator evaluate = macro (
  &quot;Takes the supplied message and evaluates it on the property bag. If nil is passed, it will return an empty string&quot;,
&nbsp;
  msg = call arguments first
  msg evaluateOn(@bag)
 )
)</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">Bag = Origin mimic
&nbsp;
Bag nil = &quot;&quot;</pre></div></div>

<p>
I figure that there is probably a pretty big hole in my code here somewhere that I&#8217;m going to expose as I play with this more, but for now, I&#8217;m happy that it&#8217;s passing my spec.</p>
<p><em>Update:</em> Thanks to Sam Aaron for pointing out the flaw in my spec.
</p>
<h2>Documentation arity</h2>
<p>
Before I conclude this post I wanted to mention the optional documetation that can be added to a method / macro / etc by passing the string that documents it in the first position.  It reads well and it&#8217;s better than standard comments because the documentation is treated as it&#8217;s own first class member of the language.
</p>
<h2>Code</h2>
<p><em>Source for this example can be found <a href="http://github.com/rubyyot/ioke-examples/tree/added_evaluator" title="Source Code" target="_blank">on github tagged as added_evaluator</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/05/getting-started-with-ispec-and-ioke-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting started with ISpec and Ioke</title>
		<link>http://blog.rubyyot.com/2009/05/getting-started-with-ispec-and-ioke/</link>
		<comments>http://blog.rubyyot.com/2009/05/getting-started-with-ispec-and-ioke/#comments</comments>
		<pubDate>Sun, 17 May 2009 03:47:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ioke]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[getting started]]></category>
		<category><![CDATA[ispec]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=508</guid>
		<description><![CDATA[Searching for common ground
Now that I have  downloaded and built the source for Ioke E, I wanted to start using it. After all,  I made a goal back in January to start using it, but as of yet had failed to follow through with it. Oh sure, I&#8217;ve been keeping up with the [...]]]></description>
			<content:encoded><![CDATA[<h2>Searching for common ground</h2>
<p>Now that I have <a href="http://ioke.org/wiki/index.php/Guide#Getting_started" title="Getting started with Ioke" target="_blank"> downloaded and built the source for Ioke E</a>, I wanted to start using it. After all, <a href="http://blog.rubyyot.com/2009/01/defecting-from-erlang-to-ioke/" title="Defecting from Erlang to Ioke" target="_blank"> I made a goal back in January</a> to start using it, but as of yet had failed to follow through with it. Oh sure, I&#8217;ve been keeping up with the blog posts and looking at it from time to time, but <a href="http://blog.rubyyot.com/2009/02/ioke-fear-of-a-folding-language/" title="Fear of a folding language" target="_blank"> really hadn&#8217;t made any steps to speak of</a>.  Until today. </p>
<p> I think that what I really needed was to find some common ground with Ioke.  Something I could call familiar and the branch out from.  <a href="http://github.com/olabini/ioke/tree/ea20401ea62f98f587bd4b2a9aa9980871f4a520/lib/ioke" title="ISpec source" target="_blank"> ISpec</a> is where I found it.  I found it in two ways really, first in the ability to write specs to test my knowledge of Ioke coding and also in reading existing specs that have been written.  These specs run when you download and build Ioke from source, which incidentally, is a painless process I would recommend to any interested.
</p>
<h2>So what&#8217;s next?</h2>
<p><strong>Note:</strong><em>I&#8217;ve pushed my code <a href="http://github.com/rubyyot/ioke-examples/tree/start_ispec" title="Start Ispec on github" target="_blank"> out to github tagged as start_ispec</a></em></p>
<p>I started out by creating a directory for my project with subdirectories for src and test</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">~<span style="color: #000000; font-weight: bold;">/</span>working $ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ioke-examples
~<span style="color: #000000; font-weight: bold;">/</span>working $ <span style="color: #7a0874; font-weight: bold;">cd</span> ioke-examples
~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>ioke-examples $ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> src <span style="color: #7a0874; font-weight: bold;">test</span></pre></div></div>

<p>Next I created my first spec as <em>test/bag_spec.ik</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">use(&quot;ispec&quot;)
use(&quot;src/bag&quot;)
&nbsp;
describe(&quot;Bag&quot;,
  it(&quot;should have the correct kind&quot;,
    Bag kind should == &quot;Bag&quot;
  )
&nbsp;
  it(&quot;should return the values in assigned cells&quot;,
    Bag name = &quot;cheeze&quot;
&nbsp;
    Bag name should == &quot;cheeze&quot;
  )
)</pre></div></div>

<p>There is nothing really interesting being tested here, the behavior is that of pretty much any Ioke object.  The only thing of note is that the use directive is from the root of the project so to specify <em>bag.ik</em> which as a relative path from the spec would be <em>../src/bag.ik</em>, was actually just src/bag.ik.  Next I made an implementation <em>src/bag.ik</em> as</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">Bag = Origin mimic</pre></div></div>

<p> This passed. Next I started making a another spec and class. Thinking that I would keep going with this path of thought.  I made <em>test/evaluator_spec.ik</em> as:</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">use(&quot;ispec&quot;)
use(&quot;src/evaluator&quot;)
&nbsp;
describe(&quot;Evaluator&quot;,
  it(&quot;should have the correct kind&quot;,
    Evaluator kind should == &quot;Evaluator&quot;
  )
&nbsp;
  describe(&quot;Evaluation&quot;,
    it(&quot;should evaluate nil as nil&quot;
      Evaluator evaluate nil should == nil
    )
  )
)</pre></div></div>

<p>and <em>src/evaluator.ik</em> as </p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">Evaluator = Origin mimic
&nbsp;
Evaluator evaluate = method (
&nbsp;
)</pre></div></div>

<p>This results in the following</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">~<span style="color: #000000; font-weight: bold;">/</span>working<span style="color: #000000; font-weight: bold;">/</span>ioke-examples$ ispec <span style="color: #7a0874; font-weight: bold;">test</span>
.P..
&nbsp;
Pending:
 Evaluator Evaluation <span style="color: #c20cb9; font-weight: bold;">true</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Not Yet Implemented<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
Finished <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">0.26</span> seconds
&nbsp;
<span style="color: #000000;">4</span> examples, <span style="color: #000000;">0</span> failures, <span style="color: #000000;">1</span> pending</pre></div></div>

<p>Pretty neat that it sees it as a pending implementation.  Overall this was a great success, ISpec was working, but something was still nagging me.</p>
<h2>Something isn&#8217;t right</h2>
<p>Maybe it&#8217;s my Ruby roots, maybe it&#8217;s that I was being picky but having to specify the source directory when referencing bag.ik and evaluator.ik just didn&#8217;t seem right.  I needed something like test_helper.rb in Ruby.</p>
<p>I looked around for a while and finally started digging into the <a href="http://github.com/olabini/ioke/tree/206d1848023a643e4740d14eaa9283692f98d2a0/test" title="Ioke test" target="_blank"> test directory for Ioke</a>, which is a great reference for the language.  Three cheers for TDD!  After a little fiddling I found that I could make a file called <em>test/helper.ik</em> as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">use(&quot;ispec&quot;)
System loadPath &lt;&lt; &quot;src&quot;</pre></div></div>

<p>This automatically loads ISpec and also adds the <em>src</em> directory to System loadPath, which is a list of the locations that Ioke will look for files in the use directive.</p>
<p>This allowed me to change use directives at the beginning of my specs to something like:
</p>

<div class="wp_syntax"><div class="code"><pre class="ioke" style="font-family:monospace;">use(&quot;test/helper&quot;)
use(&quot;bag&quot;)
&nbsp;
describe(&quot;Bag&quot;, ....</pre></div></div>

<h2>Comfort level</h2>
<p>
Now that I have my ISpec basics up and running, I hope to be playing more with this interesting language.  Hopefully you will be seeing more Ioke posts here soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/05/getting-started-with-ispec-and-ioke/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Baby steps with Ioke</title>
		<link>http://blog.rubyyot.com/2009/02/baby-steps-with-ioke/</link>
		<comments>http://blog.rubyyot.com/2009/02/baby-steps-with-ioke/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 04:23:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ioke]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=273</guid>
		<description><![CDATA[I now am ready to take some first steps with Ioke.  If you would like to install it for yourself and try it out too, you can follow the instructions or follow the Hitchhiker&#8217;s Guide.  I used the instructions for a vanilla install, but it looks like the Hitchhiker&#8217;s Guide goes into far [...]]]></description>
			<content:encoded><![CDATA[<p>I now am ready to take some first steps with Ioke.  If you would like to install it for yourself and try it out too, you can follow the <a title="Ioke Wiki" href="http://ioke.org/wiki/index.php/Guide" target="_blank">instructions</a> or <a title="Ioke dev environment" href="http://martin.elwin.com/blog/2009/01/the-hitchhikers-guide-to-an-ioke-dev-env-from-source-part-5/" target="_blank">follow the Hitchhiker&#8217;s Guide</a>.  I used the instructions for a vanilla install, but it looks like the Hitchhiker&#8217;s Guide goes into far greater detail.</p>
<p>I&#8217;ve now installed basic Ioke on Windows and Linux and it was painless in both cases, which was an unexpected pleasure.  Once installed, you can fire up the <a title="Read - Eval - Print - Loop" href="http://en.wikipedia.org/wiki/Read-eval-print_loop" target="_blank">REPL</a> with a simple <strong><em>ioke</em></strong> at the command line.  What you are presented with will look something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="ioke" style="font-family:monospace;">rubyyot@atlas:~$ ioke
iik&gt;</pre></td></tr></table></div>

<p>You are now ready to play with Ioke.  It is quite different from what I&#8217;m used to.  I would recommend that you try out the interactive mode as well to get your feet wet.  That way you will get immediate feedback.</p>
<p>A few things stand out immediately when playing around with the language.  The first is that there is no dot notation.  Second are the concepts of cells and Ground.  Third is the that it is a prototype based language.</p>
<p><strong>It&#8217;s not a dot, it is a period</strong></p>
<p>Object oriented programming is supposed to be littered with dots, it&#8217;s part of the language.  Without the dots how are we supposed to tell where one word stops and the next begins.  This is insane!</p>
<p>Or is it.  English doesn&#8217;t use dots to separate it&#8217;s words.  Tell.me.does.this.look.like.a.natural.sentence.to.you?  No, it really doesn&#8217;t to me either.   Asthetically, it&#8217;s only slightly betterThanCamelCase.   Ok, so I get it, the whitespace separates the words , or in this case they are called messages.   You may ask, &#8220;What is a period good for?&#8221;  Let&#8217;s go to the REPL and find out.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="ioke" style="font-family:monospace;">iik&gt;; &quot;hello world&quot; println
hello world
+&gt;; nil
&nbsp;
iik&gt; &quot;hello world&quot; println. &quot;hello ioke&quot; println.
hello world
hello ioke
+&gt; nil
&nbsp;
iik&gt; &quot;hello world&quot; println &quot;hello ioke&quot; println
hello world
hello ioke
+&gt; nil
&nbsp;
iik&gt; &quot;hello world&quot;. println
*** - couldn't find cell 'println' on 'Ground_0x17B4DFB' (Condition Error NoSuchCell)
&nbsp;
 &quot;hello world&quot;                                    [&lt;init&gt;:1:15]
&nbsp;
The following restarts are available:
 0: storeValue           (Store value for: println)
 1: useValue             (Use value for: println)
 2: abort                (restart: abort)
 3: quit                 (restart: quit)
&nbsp;
 dbg:1&gt;</pre></td></tr></table></div>

<p>Wow, so what&#8217;s all that?  Well I evaluated 4 statements using the REPL.  The first one simply told Ioke to print the string &#8220;hello world&#8221; on the screen followed by a new line.  So far so good, I&#8217;m now past the obligatory Hello World command.   The line beginning with +> displays the return value of the evaluated statement.  In this case it was nil, which should be familiar to those who have used Ruby and for anyone else, it means the same thing as null.</p>
<p>The next expression that I evaluate is two println statements each followed by a period so that the compiler will know that I handed it two statements.   Sure enough, we see that both lines are printed.   So, the period can be used to separate statements.  Or can it, the next experession yeilds the same results without a period in sight.   This is an interesting development.  Perhaps I had it wrong.</p>
<p>To test my theory I decided to try placing a period between the string and the println message.   What happened was that I got an error saying that println is not valid for Ground.  Even though I&#8217;m not entirely sure what ground is at this point, it&#8217;s fairly obvious that the placement of the period caused the println message to be called on something other than the string I passed it.  As a side note, the error  was nicely caught by the debugger which prompted me for an action to take.</p>
<p><strong>Ground, Origin and cells</strong></p>
<p>So let&#8217;s see what this Ground is that the debug message was talking about.  <a title="Ioke Ground definition" href="http://ioke.org/wiki/index.php/Guide#Ground" target="_blank">According to the documentation:</a></p>
<p><em>Ground is the default ground/context for evaluation. </em></p>
<p>Meaning that Ground is a high level object that is the default context for evaluation of a message.   For this to become a little clearer, a little background of the Evaluation Model helpe.  Here is an excerpt from the wiki that helps sort it out.   It takes the code <em><code>foo bar(flux bar) quux</code></em><code> and breaks down the evaluation into steps. </code></p>
<ol>
<li> The message <code>foo</code> is sent to <code>Ground</code>, which is the current ground and also the default receiver.</li>
<li> The message <code>bar</code> is sent to the result of the <code>foo</code> message. The value returned will be activated.</li>
<li> The cell <code>bar</code> contains a method in this case, and that method expects one argument, so that forces evaluation of the arguments.</li>
<li> The message <code>flux</code> is sent to <code>Ground</code>, since it&#8217;s the ground and there is no prior message inside of an argument list.</li>
<li> The message <code>bar</code> is sent to the result of the <code>flux</code> message.</li>
<li> The result of the <code>bar</code> message is used as the argument value given to the outside <code>bar</code> method.</li>
<li> The message <code>quux</code> is sent to the result of the initial <code>bar</code> message.</li>
<li> The result of the <code>quux</code> message is thrown away, unless this code is part of a larger piece of code.</li>
</ol>
<p>Here we see what it means when we say that Groud is the default context.   The messages <em>foo</em> and <em>flux</em> have no receiver (there are no words preceding them in the execution model)  so the receiver is defaulted to Ground.</p>
<p>Lets now take a closer look at objects in Ioke.  Each object has an infinite (at least that is how I see it in my mind, there probably is some sort of limit on it) number of storage containers called cells.   You can name these cells and fill them with stuff.  You can fill them with data, and objects.  These would be considered cells filled with content that is not activatable.   Here are some examples</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="ioke" style="font-family:monospace;">iik&gt; foo = Origin mimic
+&gt;  Origin_0x26FBCA:
&nbsp;
iik&gt; foo cheese = &quot;Cheddar&quot;
+&gt; &quot;Cheddar&quot;
&nbsp;
iik&gt; foo answer = 42
+&gt; 42
&nbsp;
iik&gt; foo
+&gt;  Origin_0x26FBCA:
  answer                       = 42
  cheese                       = &quot;Cheddar&quot;
&nbsp;
iik&gt; bar = Origin mimic
+&gt;  Origin_0x19A1925:
&nbsp;
iik&gt; bar size = &quot;little fish&quot;
+&gt; &quot;little fish&quot;
&nbsp;
iik&gt; foo stomach = [ bar ]
+&gt; [ Origin_0x19A1925:
  size                         = &quot;little fish&quot;
]
&nbsp;
iik&gt; foo
+&gt;  Origin_0x26FBCA:
  answer                       = 42
  cheese                       = &quot;Cheddar&quot;
  stomach                      = [Origin_0x19A1925]
&nbsp;
iik&gt; foo stomach[0]
+&gt;  Origin_0x19A1925:
  size                         = &quot;little fish&quot;</pre></td></tr></table></div>

<p>Here I&#8217;ve made two objects, each of these objects mimics Origin.   Origin being an object designed to be the starting point for other objects.  It seems to be a bit lower in the object hierarchy than Ground.</p>
<p>You can also put activatable content in the cells, these are methods (he behavior component of the object).   Here is an example using the previous objects:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="ioke" style="font-family:monospace;">iik&gt; foo ask = method(question, answer)
+&gt; ask:method(question, answer)
&nbsp;
iik&gt; foo ask (&quot;What is the meaning of life, the universe and everything?&quot;)
+&gt; 42</pre></td></tr></table></div>

<p>Here, I&#8217;m simply creating a method that takes a parameter called question and always returns the value of the cell answer.  Because a method is activatable it is executed when the cell is referenced.</p>
<p><strong>Mimics and prototypes</strong></p>
<p>Ioke is a prototype based language, this is a concept that I&#8217;m having the most difficulty with.  I&#8217;ve spent so much time working out the relationship between classes and objects, and here is a language that does away with the concept of classes altogether.  Instead of using a class as a template for a new object instance, the new object mimics an existing object.  This means that the templating comes from an instance of an existing object.  I&#8217;m going to have to get used to this one.</p>
<p>Well I&#8217;ve cracked the seal on Ioke and it&#8217;s been a pleasant experience that still seems a bit foreign.  I&#8217;m going to work with it some more and hopefully post some interesting things that I find.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/02/baby-steps-with-ioke/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ioke:  Fear of a folding language</title>
		<link>http://blog.rubyyot.com/2009/02/ioke-fear-of-a-folding-language/</link>
		<comments>http://blog.rubyyot.com/2009/02/ioke-fear-of-a-folding-language/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 02:22:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ioke]]></category>
		<category><![CDATA[change is good]]></category>
		<category><![CDATA[procrastination]]></category>

		<guid isPermaLink="false">http://blog.rubyyot.com/?p=268</guid>
		<description><![CDATA[Have you ever signed up tp do something because you knew it was something that you should do?  You are all charged and ready to go and you really don&#8217;t have to spend any effort in making the decision.  You know you want to do it.  Still, you don&#8217;t do it, at least not right [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever signed up tp do something because you knew it was something that you should do?  You are all charged and ready to go and you really don&#8217;t have to spend any effort in making the decision.  You know you want to do it.  Still, you don&#8217;t do it, at least not right away.</p>
<p>A couple weeks go by, and occasionally your internal alarm goes off, telling you that you need to <a title="Zenhabits: Someday Syndrome" href="http://zenhabits.net/2008/12/11-ways-to-cure-someday-syndrome/" target="_blank">stop procrastinating and get it started.</a> Yeah, I know how that is.   It&#8217;s been a couple more weeks than that and I haven&#8217;t started learning Ioke.  Sure, I&#8217;ve been busy.  Not so busy that I couldn&#8217;t have done anything.  Just busy enough that it&#8217;s been a good enough excuse.</p>
<p>Well, I&#8217;ll be honest.  There&#8217;s another reason why I haven&#8217;t started working on learning Ioke yet.  Truth be told, <a title="Ioke" href="http://ioke.org" target="_blank">Ioke</a> scares me a little.</p>
<p>Now don&#8217;t get me wrong, it&#8217;s a very interesting language;  one that I am very much wanting to learn.  It&#8217;s just that it&#8217;s outside of my comfort zone.  It&#8217;s foreign, and it uses strange terminology like <a title="Mimic" href="http://ioke.org/wiki/index.php/Guide#Objects" target="_blank">mimic</a> and <a title="Ground" href="http://ioke.org/wiki/index.php/Guide#Ground" target="_blank">Ground</a> and <a title="Maxros" href="http://ioke.org/wiki/index.php/Guide#Macros" target="_blank">macros</a>.  It knocks me down a few notches, tells me that I may have learned other languages, but it&#8217;s different, it won&#8217;t crack so easily.</p>
<p>Of course, that is optimal.  I wouldn&#8217;t want to attempt to expand my horizons with a year of  Python because I already know Ruby and while there would be some lessons and perspectives to learn, my time would be better spent with something further outside my comfort zone.   Java would be a similar issue, already knowing C#, eye opening moments would be minimal.</p>
<p>The very fact that Ioke both interests and pushes me out of my comfort zone makes it the perfect candidate for me to learn.  It presents a challenge which is just what I need.</p>
<p>Knowing this, it is just a matter now of powering through the initial learning curve and getting on with the benefits.  Yeah I know, I&#8217;m getting to it.  Meanwhile, are there any goals that you have set for yourself in 2009 that you have having a hard time starting?  What is holding you back?  Anything that is pulling you out of your comfort zone?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rubyyot.com/2009/02/ioke-fear-of-a-folding-language/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
