<?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>Hitesh Sarda &#187; Boo</title>
	<atom:link href="http://hitesh.in/tag/boo/feed/" rel="self" type="application/rss+xml" />
	<link>http://hitesh.in</link>
	<description>Thoughts on life, technology, education and entrepreneurship</description>
	<lastBuildDate>Fri, 30 Dec 2011 06:00:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Boo gotchas for beginners</title>
		<link>http://hitesh.in/2009/boo-gotchas-for-beginners/</link>
		<comments>http://hitesh.in/2009/boo-gotchas-for-beginners/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 17:53:02 +0000</pubDate>
		<dc:creator>Hitesh</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Boo]]></category>
		<category><![CDATA[gotchas]]></category>

		<guid isPermaLink="false">http://hitesh.in/2009/boo-gotchas-for-beginners/</guid>
		<description><![CDATA[Unlike what I mentioned in my previous post, I ended up trying Boo first. I will delve on the reason in another post. The objective of this post is to document the problems I had getting used to Boo syntax. &#8230; <a href="http://hitesh.in/2009/boo-gotchas-for-beginners/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Unlike what I mentioned in my previous post, I ended up trying Boo first. I will delve on the reason in another post. The objective of this post is to document the problems I had getting used to Boo syntax. None of the problems were big, just some missing punctuations <img src='http://hitesh.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  And I did not face any issues with the significant space.</p>
<h3>Empty array vs. Empty list</h3>
<p>An empty list is</p>
<pre><code>[]</code></pre>
<p>and an empty map is</p>
<pre><code>{}</code></pre>
<p>And empty array is</p>
<pre><code>(,)</code></pre>
<p>as it would cause ambiguity with a function / closure.</p>
<p><span id="more-215"></span></p>
<h3>Type declaration vs. Initialisation</h3>
<p><em>Declaration: </em></p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:black">_myDict </span><span style="color:darkgreen"><span style="background-color:#548dd4">as</span></span><span style="color:black"> Dictionary</span><span style="color:darkgreen">[</span><strong><span style="color:blue">of </span><span style="color:purple">string</span></strong><span style="color:darkgreen">, </span><span style="color:purple"><strong>object</strong></span><span style="color:darkgreen">]<br />
</span></span></p>
<p><em>Initialisation: </em></p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:black">_myDict </span><span style="color:darkgreen">= </span><span style="color:black">Dictionary</span><span style="color:darkgreen">[</span><strong><span style="color:blue">of </span><span style="color:purple">string</span></strong><span style="color:darkgreen">, </span><span style="color:purple"><strong>object</strong></span><span style="color:darkgreen">]<span style="background-color:#548dd4"><strong>()</strong></span></span></span></p>
<h3>Assigning a Type vs. invoking a function</h3>
<p>When you are calling a function don&#8217;t forget the brackets at the end.</p>
<p><em>Wrong: </em></p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:black">fs </span><span style="color:darkgreen">= </span><span style="color:black">file</span><span style="color:darkgreen">.</span><span style="color:midnightblue">OpenRead</span><span style="color:darkgreen"><br />
</span></span></p>
<p><em>Correct: </em></p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:black">fs </span><span style="color:darkgreen">= </span><span style="color:black">file</span><span style="color:darkgreen">.</span><span style="color:midnightblue">OpenRead</span><span style="color:darkgreen"><span style="background-color:#548dd4">()</span><br />
</span></span></p>
<p>If you make this mistake you will get errors like:</p>
<p><span style="font-family: monospace, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">&#8216;&lt;method/property&gt;&#8217; is not a member of &#8216;&lt;some type&gt;&#8217;.  (BCE0019)</span></p>
<p><strong>Colon is the new semicolon</strong></p>
<p>Remember the times when a missing semicolon used to be causing most compile errors, well, in boo it will be the missing colon which signifies a beginning of a block.</p>
<p><em>Wrong: </em></p>
<p><span style="color:blue"><strong>while </strong></span><span style="color:darkgreen">((</span><span style="color:black">line </span><span style="color:darkgreen">= </span><span style="color:black">filestream</span><span style="color:darkgreen">.</span><span style="color:midnightblue">ReadLine</span><span style="color:darkgreen">()) != </span><span style="color:black"><strong>null</strong></span><span style="color:darkgreen">)<br />
</span></p>
<p><span style="color:black"> m</span><span style="color:darkgreen">.</span><span style="color:midnightblue">parse</span><span style="color:darkgreen">(</span><span style="color:black">line</span><span style="color:darkgreen">)</span></p>
<p><em>Correct: </em></p>
<p><span style="color:blue"><strong>while </strong></span><span style="color:darkgreen">((</span><span style="color:black">line </span><span style="color:darkgreen">= </span><span style="color:black">filestream</span><span style="color:darkgreen">.</span><span style="color:midnightblue">ReadLine</span><span style="color:darkgreen">()) != </span><span style="color:black"><strong>null</strong></span><span style="color:darkgreen">)<span style="background-color:#548dd4">:</span><br />
</span></p>
<p><span style="color:black"> m</span><span style="color:darkgreen">.</span><span style="color:midnightblue">parse</span><span style="color:darkgreen">(</span><span style="color:black">line</span><span style="color:darkgreen">)</span></p>
<p>If you forget the colon, you will get an error like:</p>
<p><code><br />
Unexpected token: m. (BCE0043)<br />
Unexpected token: &lt;INDENT&gt;. (BCE0043)<br />
expecting "EOF", found '&lt;DEDENT&gt;'. (BCE0044)<br />
</code></p>
<h3>Function definition in a script file</h3>
<p>Maybe a no-brainer for python gurus, but if you have a script file, i.e. a file with no class, just instructions; functions are to be defined near the top of the script and called after it is <span style="font-family: monospace, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">def<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;">&#8216;ed.</span></span></p>
<h3>You can&#8217;t mix Boo with C# in same project</h3>
<p>This is my mistake, but looking at samples having groovy and java files in same project; I blindly assumed that the same applies to Boo as well.</p>
<h3>Intellisense / auto-complete does not work well.</h3>
<p>Given the dynamic nature of Boo and maybe some bugs in SharpDevelop, it is not a great experience if you rely heavily on intellisense.</p>
<p><img src="http://hitesh.in/wp-content/uploads/2009/08/083009_1753_Boogotchasf1.png" alt="" /></p>
<h3>Embedding special characters in a string</h3>
<p>Boo follows the python way of embedding special characters in string and not c#.</p>
<p>Wrong:</p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:black">s </span><span style="color:darkgreen">= </span><span style="color:black">@</span><span style="color:blue">&#8220;C:\path\to\dir\&#8221;</span></span></p>
<p>Correct:</p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:#04abab">s </span><span style="color:darkgreen">= </span><span style="color:green">&#8220;&#8221;"C:\path\to\dir\&#8221;"&#8221;</span></span></p>
<h3>Embedding values in strings</h3>
<p>The syntax is slightly weird, but useful nonetheless. You need to use both $ and enclose the variable in curly braces.</p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:purple">print </span><span style="color:blue">&#8220;processing </span><span style="color:#993366">${dir.Name}</span><span style="color:blue">&#8220;</span></span></p>
<h3>Still can&#8217;t find a way to pattern match and assign in the same line</h3>
<p>I think this is possible, but I can&#8217;t figure a way to match a strung and assign the values to 2 variables.</p>
<p>I am trying to do something like, below and a few variations without luck:</p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:black">key</span><span style="color:darkgreen">, </span><span style="color:black">val </span><span style="color:darkgreen">= </span><span style="color:#ff6600">/(?&lt;key&gt;[^=\s]+)\s*=\s*&#8221;(?&lt;value&gt;.+)&#8221;\s*$/</span><span style="color:darkgreen">.</span><span style="color:midnightblue">Match</span><span style="color:darkgreen">(</span><span style="color:black">line</span><span style="color:darkgreen">)<br />
</span></span></p>
<p>If the regex would have been simpler I could have used the <span style="color:midnightblue; font-family:Consolas; font-size:10pt">Split</span> instead of <span style="color:midnightblue; font-family:Consolas; font-size:10pt">Match</span> and things would have worked.</p>
<p>I ended up with something like:</p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:#04abab">data </span><span style="color:darkgreen">= </span><span style="color:#ff6600">/(?&lt;key&gt;[^=\s]+)\s*=\s*&#8221;(?&lt;value&gt;.+)&#8221;\s*$/</span><span style="color:darkgreen">.</span><span style="color:midnightblue">Match</span><span style="color:darkgreen">(</span><span style="color:black">line</span><span style="color:darkgreen">)<br />
</span></span></p>
<p><span style="font-family:Consolas; font-size:10pt"><span style="color:darkgreen"> </span><span style="color:black">key</span><span style="color:darkgreen">, </span><span style="color:black">val </span><span style="color:darkgreen">= </span><span style="color:black">data</span><span style="color:darkgreen">.</span><span style="color:black">Groups</span><span style="color:darkgreen">[</span><span style="color:blue">"key"</span><span style="color:darkgreen">].</span><span style="color:black">Value</span><span style="color:darkgreen">, </span><span style="color:black">data</span><span style="color:darkgreen">.</span><span style="color:black">Groups</span><span style="color:darkgreen">[</span><span style="color:blue">"value"</span><span style="color:darkgreen">].</span><span style="color:black">Value</span></span></p>
<h3>Embedding spaces in a regular expression patterns</h3>
<p>As seen in the regex sample above, take extra care when you want to match a space. Use \s instead of a literal space.</p>
]]></content:encoded>
			<wfw:commentRss>http://hitesh.in/2009/boo-gotchas-for-beginners/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The great runtime shootout</title>
		<link>http://hitesh.in/2009/the-great-runtime-shootout/</link>
		<comments>http://hitesh.in/2009/the-great-runtime-shootout/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 21:32:58 +0000</pubDate>
		<dc:creator>Hitesh</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Boo]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[CLR]]></category>
		<category><![CDATA[Groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[TOTW]]></category>

		<guid isPermaLink="false">http://hitesh.in/?p=196</guid>
		<description><![CDATA[It is becoming more and more obvious that there are just two runtimes left to execute code, the Java Virtual Machine (JVM) and the Common Language Infrastructure (CLI). So, I decided to see how they stack up. Looks like both &#8230; <a href="http://hitesh.in/2009/the-great-runtime-shootout/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It is becoming more and more obvious that there are just two runtimes left to execute code, the <em>Java Virtual Machine</em> (JVM) and the <em>Common Language Infrastructure</em> (CLI). So, I decided to see how they stack up. Looks like both environments have something for everyone.</p>
<p>Here is a list of programming languages available on these runtimes.</p>
<p><a href="http://hitesh.in/wp-content/uploads/2009/08/slide0001_image001_thumb.png"><img style="display: inline; border: 0px initial initial;" title="JVM vs. CLR" src="http://hitesh.in/wp-content/uploads/2009/08/slide0001_image001_thumb.png" border="0" alt="JVM vs CLI" width="650" height="518" /></a></p>
<ol>
<li>Can run on CLI using IKVM.NET</li>
<li>Can run on JVM using Mainsoft solution</li>
<li>Not yet usable</li>
<li>Can run on CLR, but is behind the JVM implementation</li>
</ol>
<p>The main reason for the research was to identify a new language I should pick-up. I looked at Python and Ruby, but both have some sore thumbs that I just can&#8217;t stand. I really liked Boo and Groovy; they are similar to C#/Java in syntax and incorporate the good things from Python. Although I like Boo&#8217;s syntax and approach more than Groovy, Groovy has a more mature implementation and ecosystem. I will try to use Groovy for some hobby project and get a feel to things.</p>
]]></content:encoded>
			<wfw:commentRss>http://hitesh.in/2009/the-great-runtime-shootout/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

