<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:posterous="http://posterous.com/help/rss/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Too Curmudgeonly For My Age</title>
    <link>http://mfollett.com</link>
    <description>Most recent posts at Too Curmudgeonly For My Age</description>
    <generator>posterous.com</generator>
    <link xmlns="http://www.w3.org/2005/Atom" href="http://posterous.com/api/sup_update#9f5ab7a7d" type="application/json" rel="http://api.friendfeed.com/2008/03#sup" />
    
    
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TooMuchMeta" /><feedburner:info uri="toomuchmeta" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://posterous.superfeedr.com/" /><item>
      <pubDate>Fri, 10 Feb 2012 09:35:00 -0800</pubDate>
      <title>When Type Systems Attack</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/99AdKqsDwTs/when-type-systems-attack</link>
      <guid isPermaLink="false">http://mfollett.com/when-type-systems-attack</guid>
      <description>&lt;p&gt;
	&lt;p&gt;Groovy&amp;rsquo;s type system can sometimes have funny interplay and unexpected results. For example, these assertions are true:&lt;/p&gt;

&lt;p&gt;&lt;div class="data type-groovy"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;&lt;span class="n"&gt;Long&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&lt;span class="n"&gt;Integer&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;p&gt;However, mixing in a Map into this causes some complications:&lt;/p&gt;

&lt;p&gt;&lt;div class="data type-groovy"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;&lt;span class="n"&gt;Long&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&lt;span class="n"&gt;Integer&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&lt;span class="n"&gt;def&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;[(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;):&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;):&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;p&gt;This might not seem like a big issue, but it can cause some real headaches. When failing an assertion the message printed only prints values, not types. Because of this you may occasionally run into less than helpful error messages like:&lt;/p&gt;

&lt;p&gt;&lt;div class="data type-text"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;assert a == b&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| |  |&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| |  [4:4]&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;| false&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[4:4]&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;p&gt;And this can be awfully confusing. One prime example of this is with GORM domains. GORM defaults primary keys to be Longs so if you use a primary key as a map key you could run into some pretty confusing error cases that your tests don&amp;rsquo;t explain as helpfully as you&amp;rsquo;d like.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/when-type-systems-attack"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/when-type-systems-attack#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=99AdKqsDwTs:Yetsi82YtK0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=99AdKqsDwTs:Yetsi82YtK0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=99AdKqsDwTs:Yetsi82YtK0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=99AdKqsDwTs:Yetsi82YtK0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/99AdKqsDwTs" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/when-type-systems-attack</feedburner:origLink></item>
    <item>
      <pubDate>Wed, 25 Jan 2012 13:52:00 -0800</pubDate>
      <title>Grails/DatabaseMigrationPlugin/Liquibase Quirk</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/b0kNZRgQO2Y/grailsdatabasemigrationpluginliquibase-quirk</link>
      <guid isPermaLink="false">http://mfollett.com/grailsdatabasemigrationpluginliquibase-quirk</guid>
      <description>&lt;p&gt;
	&lt;p&gt;I just fought with this for a while and figured I'd record this in the vast internets in case others come across this. While attempting to extend the functionality of our Grails project at work I needed to add a new table and related foreign key constraints. We use the Grails Database Migration Plugin which uses liquibase to keep our schema in sync between production, staging, and development boxes. I declared a foreign key constraint similar to this one:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-text"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;span rel="#L6" id="L6"&gt;6&lt;/span&gt;
&lt;span rel="#L7" id="L7"&gt;7&lt;/span&gt;
&lt;span rel="#L8" id="L8"&gt;8&lt;/span&gt;
&lt;span rel="#L9" id="L9"&gt;9&lt;/span&gt;
&lt;span rel="#L10" id="L10"&gt;10&lt;/span&gt;
&lt;span rel="#L11" id="L11"&gt;11&lt;/span&gt;
&lt;span rel="#L12" id="L12"&gt;12&lt;/span&gt;
&lt;span rel="#L13" id="L13"&gt;13&lt;/span&gt;
&lt;span rel="#L14" id="L14"&gt;14&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;addForeignKeyConstraint(&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;baseColumnNames: &amp;#39;column_name,&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;baseTableSchemaName: &amp;#39;my_schema&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;baseTableName: &amp;#39;my_table&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;constraintName: &amp;#39;my_constraint_name&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;deferrable: &amp;#39;false&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;initiallyDeferred: &amp;#39;false&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;onDelete: &amp;#39;CASCADE&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC9"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;onUpdate: &amp;#39;CASCADE&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC10"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;referencedTableName: &amp;#39;referenced_table&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;referencedColumnNames: &amp;#39;my_referenced_column&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC12"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;referencedTableSchemaName: &amp;#39;my_schema&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC13"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;referencesUniqueColumn: &amp;#39;true&amp;#39;,&lt;/div&gt;&lt;div class="line" id="LC14"&gt;)&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;and got this exception:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-text"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;span rel="#L6" id="L6"&gt;6&lt;/span&gt;
&lt;span rel="#L7" id="L7"&gt;7&lt;/span&gt;
&lt;span rel="#L8" id="L8"&gt;8&lt;/span&gt;
&lt;span rel="#L9" id="L9"&gt;9&lt;/span&gt;
&lt;span rel="#L10" id="L10"&gt;10&lt;/span&gt;
&lt;span rel="#L11" id="L11"&gt;11&lt;/span&gt;
&lt;span rel="#L12" id="L12"&gt;12&lt;/span&gt;
&lt;span rel="#L13" id="L13"&gt;13&lt;/span&gt;
&lt;span rel="#L14" id="L14"&gt;14&lt;/span&gt;
&lt;span rel="#L15" id="L15"&gt;15&lt;/span&gt;
&lt;span rel="#L16" id="L16"&gt;16&lt;/span&gt;
&lt;span rel="#L17" id="L17"&gt;17&lt;/span&gt;
&lt;span rel="#L18" id="L18"&gt;18&lt;/span&gt;
&lt;span rel="#L19" id="L19"&gt;19&lt;/span&gt;
&lt;span rel="#L20" id="L20"&gt;20&lt;/span&gt;
&lt;span rel="#L21" id="L21"&gt;21&lt;/span&gt;
&lt;span rel="#L22" id="L22"&gt;22&lt;/span&gt;
&lt;span rel="#L23" id="L23"&gt;23&lt;/span&gt;
&lt;span rel="#L24" id="L24"&gt;24&lt;/span&gt;
&lt;span rel="#L25" id="L25"&gt;25&lt;/span&gt;
&lt;span rel="#L26" id="L26"&gt;26&lt;/span&gt;
&lt;span rel="#L27" id="L27"&gt;27&lt;/span&gt;
&lt;span rel="#L28" id="L28"&gt;28&lt;/span&gt;
&lt;span rel="#L29" id="L29"&gt;29&lt;/span&gt;
&lt;span rel="#L30" id="L30"&gt;30&lt;/span&gt;
&lt;span rel="#L31" id="L31"&gt;31&lt;/span&gt;
&lt;span rel="#L32" id="L32"&gt;32&lt;/span&gt;
&lt;span rel="#L33" id="L33"&gt;33&lt;/span&gt;
&lt;span rel="#L34" id="L34"&gt;34&lt;/span&gt;
&lt;span rel="#L35" id="L35"&gt;35&lt;/span&gt;
&lt;span rel="#L36" id="L36"&gt;36&lt;/span&gt;
&lt;span rel="#L37" id="L37"&gt;37&lt;/span&gt;
&lt;span rel="#L38" id="L38"&gt;38&lt;/span&gt;
&lt;span rel="#L39" id="L39"&gt;39&lt;/span&gt;
&lt;span rel="#L40" id="L40"&gt;40&lt;/span&gt;
&lt;span rel="#L41" id="L41"&gt;41&lt;/span&gt;
&lt;span rel="#L42" id="L42"&gt;42&lt;/span&gt;
&lt;span rel="#L43" id="L43"&gt;43&lt;/span&gt;
&lt;span rel="#L44" id="L44"&gt;44&lt;/span&gt;
&lt;span rel="#L45" id="L45"&gt;45&lt;/span&gt;
&lt;span rel="#L46" id="L46"&gt;46&lt;/span&gt;
&lt;span rel="#L47" id="L47"&gt;47&lt;/span&gt;
&lt;span rel="#L48" id="L48"&gt;48&lt;/span&gt;
&lt;span rel="#L49" id="L49"&gt;49&lt;/span&gt;
&lt;span rel="#L50" id="L50"&gt;50&lt;/span&gt;
&lt;span rel="#L51" id="L51"&gt;51&lt;/span&gt;
&lt;span rel="#L52" id="L52"&gt;52&lt;/span&gt;
&lt;span rel="#L53" id="L53"&gt;53&lt;/span&gt;
&lt;span rel="#L54" id="L54"&gt;54&lt;/span&gt;
&lt;span rel="#L55" id="L55"&gt;55&lt;/span&gt;
&lt;span rel="#L56" id="L56"&gt;56&lt;/span&gt;
&lt;span rel="#L57" id="L57"&gt;57&lt;/span&gt;
&lt;span rel="#L58" id="L58"&gt;58&lt;/span&gt;
&lt;span rel="#L59" id="L59"&gt;59&lt;/span&gt;
&lt;span rel="#L60" id="L60"&gt;60&lt;/span&gt;
&lt;span rel="#L61" id="L61"&gt;61&lt;/span&gt;
&lt;span rel="#L62" id="L62"&gt;62&lt;/span&gt;
&lt;span rel="#L63" id="L63"&gt;63&lt;/span&gt;
&lt;span rel="#L64" id="L64"&gt;64&lt;/span&gt;
&lt;span rel="#L65" id="L65"&gt;65&lt;/span&gt;
&lt;span rel="#L66" id="L66"&gt;66&lt;/span&gt;
&lt;span rel="#L67" id="L67"&gt;67&lt;/span&gt;
&lt;span rel="#L68" id="L68"&gt;68&lt;/span&gt;
&lt;span rel="#L69" id="L69"&gt;69&lt;/span&gt;
&lt;span rel="#L70" id="L70"&gt;70&lt;/span&gt;
&lt;span rel="#L71" id="L71"&gt;71&lt;/span&gt;
&lt;span rel="#L72" id="L72"&gt;72&lt;/span&gt;
&lt;span rel="#L73" id="L73"&gt;73&lt;/span&gt;
&lt;span rel="#L74" id="L74"&gt;74&lt;/span&gt;
&lt;span rel="#L75" id="L75"&gt;75&lt;/span&gt;
&lt;span rel="#L76" id="L76"&gt;76&lt;/span&gt;
&lt;span rel="#L77" id="L77"&gt;77&lt;/span&gt;
&lt;span rel="#L78" id="L78"&gt;78&lt;/span&gt;
&lt;span rel="#L79" id="L79"&gt;79&lt;/span&gt;
&lt;span rel="#L80" id="L80"&gt;80&lt;/span&gt;
&lt;span rel="#L81" id="L81"&gt;81&lt;/span&gt;
&lt;span rel="#L82" id="L82"&gt;82&lt;/span&gt;
&lt;span rel="#L83" id="L83"&gt;83&lt;/span&gt;
&lt;span rel="#L84" id="L84"&gt;84&lt;/span&gt;
&lt;span rel="#L85" id="L85"&gt;85&lt;/span&gt;
&lt;span rel="#L86" id="L86"&gt;86&lt;/span&gt;
&lt;span rel="#L87" id="L87"&gt;87&lt;/span&gt;
&lt;span rel="#L88" id="L88"&gt;88&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;2012-01-25 15:53:13,963 [Thread-12] ERROR context.GrailsContextLoader  - Error executing bootstraps: liquibase.exception.ValidationFailedException: Validation Failed:&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1 changes have validation errors&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;java.lang.ClassCastException: liquibase.statement.core.AddForeignKeyConstraintStatement cannot be cast to liquibase.statement.core.CreateTableStatement&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC5"&gt;org.codehaus.groovy.runtime.InvokerInvocationException: liquibase.exception.ValidationFailedException: Validation Failed:&lt;/div&gt;&lt;div class="line" id="LC6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1 changes have validation errors&lt;/div&gt;&lt;div class="line" id="LC7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;java.lang.ClassCastException: liquibase.statement.core.AddForeignKeyConstraintStatement cannot be cast to liquibase.statement.core.CreateTableStatement&lt;/div&gt;&lt;div class="line" id="LC8"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC9"&gt;	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:97)&lt;/div&gt;&lt;div class="line" id="LC10"&gt;	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)&lt;/div&gt;&lt;div class="line" id="LC11"&gt;	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)&lt;/div&gt;&lt;div class="line" id="LC12"&gt;	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)&lt;/div&gt;&lt;div class="line" id="LC13"&gt;	at groovy.lang.Closure.call(Closure.java:410)&lt;/div&gt;&lt;div class="line" id="LC14"&gt;	at DatabaseMigrationGrailsPlugin$_closure2.call(DatabaseMigrationGrailsPlugin.groovy)&lt;/div&gt;&lt;div class="line" id="LC15"&gt;	at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.doWithApplicationContext(DefaultGrailsPlugin.java:489)&lt;/div&gt;&lt;div class="line" id="LC16"&gt;	at org.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager.doPostProcessing(AbstractGrailsPluginManager.java:169)&lt;/div&gt;&lt;div class="line" id="LC17"&gt;	at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.performPostProcessing(GrailsRuntimeConfigurator.java:232)&lt;/div&gt;&lt;div class="line" id="LC18"&gt;	at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:172)&lt;/div&gt;&lt;div class="line" id="LC19"&gt;	at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:124)&lt;/div&gt;&lt;div class="line" id="LC20"&gt;	at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:121)&lt;/div&gt;&lt;div class="line" id="LC21"&gt;	at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:104)&lt;/div&gt;&lt;div class="line" id="LC22"&gt;	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)&lt;/div&gt;&lt;div class="line" id="LC23"&gt;	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)&lt;/div&gt;&lt;div class="line" id="LC24"&gt;	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)&lt;/div&gt;&lt;div class="line" id="LC25"&gt;	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)&lt;/div&gt;&lt;div class="line" id="LC26"&gt;	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)&lt;/div&gt;&lt;div class="line" id="LC27"&gt;	at java.util.concurrent.FutureTask.run(FutureTask.java:138)&lt;/div&gt;&lt;div class="line" id="LC28"&gt;	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)&lt;/div&gt;&lt;div class="line" id="LC29"&gt;	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)&lt;/div&gt;&lt;div class="line" id="LC30"&gt;	at java.lang.Thread.run(Thread.java:680)&lt;/div&gt;&lt;div class="line" id="LC31"&gt;Caused by: liquibase.exception.ValidationFailedException: Validation Failed:&lt;/div&gt;&lt;div class="line" id="LC32"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1 changes have validation errors&lt;/div&gt;&lt;div class="line" id="LC33"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;java.lang.ClassCastException: liquibase.statement.core.AddForeignKeyConstraintStatement cannot be cast to liquibase.statement.core.CreateTableStatement&lt;/div&gt;&lt;div class="line" id="LC34"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC35"&gt;	at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:138)&lt;/div&gt;&lt;div class="line" id="LC36"&gt;	at liquibase.Liquibase.update(Liquibase.java:110)&lt;/div&gt;&lt;div class="line" id="LC37"&gt;	at liquibase.Liquibase$update.call(Unknown Source)&lt;/div&gt;&lt;div class="line" id="LC38"&gt;	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)&lt;/div&gt;&lt;div class="line" id="LC39"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)&lt;/div&gt;&lt;div class="line" id="LC40"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)&lt;/div&gt;&lt;div class="line" id="LC41"&gt;	at grails.plugin.databasemigration.MigrationRunner$_autoRun_closure1.doCall(MigrationRunner.groovy:50)&lt;/div&gt;&lt;div class="line" id="LC42"&gt;	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;/div&gt;&lt;div class="line" id="LC43"&gt;	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)&lt;/div&gt;&lt;div class="line" id="LC44"&gt;	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)&lt;/div&gt;&lt;div class="line" id="LC45"&gt;	at java.lang.reflect.Method.invoke(Method.java:597)&lt;/div&gt;&lt;div class="line" id="LC46"&gt;	at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1231)&lt;/div&gt;&lt;div class="line" id="LC47"&gt;	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:226)&lt;/div&gt;&lt;div class="line" id="LC48"&gt;	at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)&lt;/div&gt;&lt;div class="line" id="LC49"&gt;	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)&lt;/div&gt;&lt;div class="line" id="LC50"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)&lt;/div&gt;&lt;div class="line" id="LC51"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)&lt;/div&gt;&lt;div class="line" id="LC52"&gt;	at grails.plugin.databasemigration.MigrationRunner$_autoRun_closure1.doCall(MigrationRunner.groovy)&lt;/div&gt;&lt;div class="line" id="LC53"&gt;	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;/div&gt;&lt;div class="line" id="LC54"&gt;	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)&lt;/div&gt;&lt;div class="line" id="LC55"&gt;	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)&lt;/div&gt;&lt;div class="line" id="LC56"&gt;	at java.lang.reflect.Method.invoke(Method.java:597)&lt;/div&gt;&lt;div class="line" id="LC57"&gt;	at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1231)&lt;/div&gt;&lt;div class="line" id="LC58"&gt;	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)&lt;/div&gt;&lt;div class="line" id="LC59"&gt;	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)&lt;/div&gt;&lt;div class="line" id="LC60"&gt;	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)&lt;/div&gt;&lt;div class="line" id="LC61"&gt;	at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110)&lt;/div&gt;&lt;div class="line" id="LC62"&gt;	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)&lt;/div&gt;&lt;div class="line" id="LC63"&gt;	at groovy.lang.Closure.call(Closure.java:410)&lt;/div&gt;&lt;div class="line" id="LC64"&gt;	at grails.plugin.databasemigration.MigrationRunner$_autoRun_closure1.call(MigrationRunner.groovy)&lt;/div&gt;&lt;div class="line" id="LC65"&gt;	at groovy.lang.Closure.call(Closure.java:404)&lt;/div&gt;&lt;div class="line" id="LC66"&gt;	at grails.plugin.databasemigration.MigrationRunner$_autoRun_closure1.call(MigrationRunner.groovy)&lt;/div&gt;&lt;div class="line" id="LC67"&gt;	at java_util_concurrent_Callable$call.call(Unknown Source)&lt;/div&gt;&lt;div class="line" id="LC68"&gt;	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)&lt;/div&gt;&lt;div class="line" id="LC69"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)&lt;/div&gt;&lt;div class="line" id="LC70"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)&lt;/div&gt;&lt;div class="line" id="LC71"&gt;	at grails.plugin.databasemigration.MigrationUtils.executeInSession(MigrationUtils.groovy:99)&lt;/div&gt;&lt;div class="line" id="LC72"&gt;	at grails.plugin.databasemigration.MigrationUtils$executeInSession.call(Unknown Source)&lt;/div&gt;&lt;div class="line" id="LC73"&gt;	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)&lt;/div&gt;&lt;div class="line" id="LC74"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)&lt;/div&gt;&lt;div class="line" id="LC75"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)&lt;/div&gt;&lt;div class="line" id="LC76"&gt;	at grails.plugin.databasemigration.MigrationRunner.autoRun(MigrationRunner.groovy:46)&lt;/div&gt;&lt;div class="line" id="LC77"&gt;	at grails.plugin.databasemigration.MigrationRunner$autoRun.call(Unknown Source)&lt;/div&gt;&lt;div class="line" id="LC78"&gt;	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)&lt;/div&gt;&lt;div class="line" id="LC79"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)&lt;/div&gt;&lt;div class="line" id="LC80"&gt;	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)&lt;/div&gt;&lt;div class="line" id="LC81"&gt;	at DatabaseMigrationGrailsPlugin$_closure2.doCall(DatabaseMigrationGrailsPlugin.groovy:84)&lt;/div&gt;&lt;div class="line" id="LC82"&gt;	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;/div&gt;&lt;div class="line" id="LC83"&gt;	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)&lt;/div&gt;&lt;div class="line" id="LC84"&gt;	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)&lt;/div&gt;&lt;div class="line" id="LC85"&gt;	at java.lang.reflect.Method.invoke(Method.java:597)&lt;/div&gt;&lt;div class="line" id="LC86"&gt;	at com.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1231)&lt;/div&gt;&lt;div class="line" id="LC87"&gt;	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)&lt;/div&gt;&lt;div class="line" id="LC88"&gt;	... 21 more&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;It turns out that passing in a named parameter of referencesUniqueColumn with a value of anything other than false causes this exception. This wasn't immediately obvious to me and I still don't know why, but I thought I'd note it in case someone else ran into it too.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/grailsdatabasemigrationpluginliquibase-quirk"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/grailsdatabasemigrationpluginliquibase-quirk#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=b0kNZRgQO2Y:36hVzvp9O7U:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=b0kNZRgQO2Y:36hVzvp9O7U:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=b0kNZRgQO2Y:36hVzvp9O7U:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=b0kNZRgQO2Y:36hVzvp9O7U:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/b0kNZRgQO2Y" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/grailsdatabasemigrationpluginliquibase-quirk</feedburner:origLink></item>
    <item>
      <pubDate>Mon, 23 Jan 2012 23:33:00 -0800</pubDate>
      <title>Grails Custom Validation messages</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/cJQwvwjRN-k/grails-custom-validation-messages</link>
      <guid isPermaLink="false">http://mfollett.com/grails-custom-validation-messages</guid>
      <description>&lt;p&gt;
	&lt;p&gt;Grails' GORM provides convenient ways to define many different constraints for inputing properties including basic ones like max, equal, &amp;amp; notEqual to more specific ones like creditCard, url, &amp;amp; email (full list &lt;a href="http://grails.org/doc/2.0.0/ref/Constraints/Usage.html"&gt;here&lt;/a&gt; under Quick Reference). But sooner or later you&amp;rsquo;ll want to create your own custom validator. This can be done by providing a validator closure to your domain, for example:&lt;/p&gt;

&lt;p&gt;&lt;div class="data type-groovy"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;span rel="#L6" id="L6"&gt;6&lt;/span&gt;
&lt;span rel="#L7" id="L7"&gt;7&lt;/span&gt;
&lt;span rel="#L8" id="L8"&gt;8&lt;/span&gt;
&lt;span rel="#L9" id="L9"&gt;9&lt;/span&gt;
&lt;span rel="#L10" id="L10"&gt;10&lt;/span&gt;
&lt;span rel="#L11" id="L11"&gt;11&lt;/span&gt;
&lt;span rel="#L12" id="L12"&gt;12&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Groovyist&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;password&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;Long&lt;/span&gt;   &lt;span class="n"&gt;favoritePrime&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC6"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="n"&gt;constraints&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="nl"&gt;blank:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;unique:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC9"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="nl"&gt;size:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;blank:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC10"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="nl"&gt;email:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;blank:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;favoritePrime&lt;/span&gt; &lt;span class="nl"&gt;validator:&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;BigInteger&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;isProbablePrime&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC12"&gt;&lt;span class="o"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Now, in this example a domain will validate all of the fields, including the user&amp;rsquo;s favorite prime (to a degree of certainty). However, if the prime number certainly isn&amp;rsquo;t prime then the error message provided when validation fails (through validate or save) will be:&lt;/p&gt;

&lt;blockquote class="posterous_short_quote"&gt;&lt;p&gt;favoritePrime does not pass custom validation.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That probably isn&amp;rsquo;t a helpful message to eventually pass back to the user, they might guess what the mysterious &amp;ldquo;custom validation&amp;rdquo; is in this case, but certainly not in all others.&lt;/p&gt;

&lt;p&gt;So what &lt;em&gt;is&lt;/em&gt; the solution? You might try passing an error message back, but that won&amp;rsquo;t work; you&amp;rsquo;ll get the same message again. It turns out the proper approach is to return a key from your &lt;code&gt;message.properties&lt;/code&gt; file. If the key exists in the proper localization file (e.g. French is messages_fr.properties) then it will use that string. A simple modification to the validator above will solve this:&lt;/p&gt;

&lt;p&gt;&lt;div class="data type-groovy"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;&lt;span class="n"&gt;favoritePrime&lt;/span&gt; &lt;span class="n"&gt;validator&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="n"&gt;BigInteger&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="o"&gt;).&lt;/span&gt;&lt;span class="na"&gt;isProbablePrime&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;99&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="err"&gt;&amp;#39;&lt;/span&gt;&lt;span class="n"&gt;my&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;localized&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;not&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;prime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="err"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Adding the line:&lt;/p&gt;

&lt;p&gt;my.localized.not.prime.message=The number {2} is not prime.&lt;/p&gt;

&lt;p&gt;Will cause Grails to generate a much more useful validation failed
message. As you can probably guess the {2} will be replaced with the
value inputed by the user.&lt;/p&gt;

&lt;p&gt;You can include additional values to your message by returning an array. The first element should be a message key (e.g. &amp;lsquo;my.localized.not.prime.message&amp;rsquo;) and the subsequent entries will be interpolated into the message starting at index 3. So, if you returned &lt;code&gt;['my.localized.not.prime.message', 5]&lt;/code&gt; you could have the message:
my.localized.not.prime.message=The number {2} is not prime, {3} is an example of a prime.
And in this case if the user passed in 4 they would end up with the message:&lt;/p&gt;

&lt;blockquote class="posterous_short_quote"&gt;&lt;p&gt;The number 4 is not prime, 5 is an example of a prime.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Of course, if you aren&amp;rsquo;t using a prime number validator multiple times
in your code it may seem silly to have a special key/value pair
dedicated to primes. Another option is to use a key/value pair dedicated
to that field. You can do this simply by using the code in the first
example and addding a field to your message.properties file like:&lt;/p&gt;

&lt;p&gt;Groovyist.favoritePrime.validator.invalid=The number {2} is not prime.&lt;/p&gt;

&lt;p&gt;Much of this is documented in the &lt;a href="http://grails.org/doc/2.0.0/ref/Constraints/validator.html"&gt;validator docs&lt;/a&gt;.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/grails-custom-validation-messages"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/grails-custom-validation-messages#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=cJQwvwjRN-k:Jr4MAwPWXlM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=cJQwvwjRN-k:Jr4MAwPWXlM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=cJQwvwjRN-k:Jr4MAwPWXlM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=cJQwvwjRN-k:Jr4MAwPWXlM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/cJQwvwjRN-k" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/grails-custom-validation-messages</feedburner:origLink></item>
    <item>
      <pubDate>Tue, 29 Nov 2011 20:14:00 -0800</pubDate>
      <title>Yammer, Scala, &amp; Burgeoning Languages</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/Hh3KhRHswac/yammer-scala-burgeoning-languages</link>
      <guid isPermaLink="false">http://mfollett.com/yammer-scala-burgeoning-languages</guid>
      <description>&lt;p&gt;
	&lt;p&gt;I just finished reading &lt;a href="https://gist.github.com/1406238?1"&gt;this letter&lt;/a&gt; discussing why Yammer is going to slowly move from Scala to Java. While I&amp;rsquo;ve never done anything more substantial than basic toying around with scala and can&amp;rsquo;t say I know much about Yammer outside of what their website tells me about itself and the fact that &lt;a href="http://www.gabrielweinberg.com/blog/2011/11/online-services-our-startup-subscribes-to.html"&gt;Gabriel Weinberg&lt;/a&gt; seems to like it I do have some thoughts on general points hit on in the letter.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://codahale.com/downloads/email-to-donald.txt"&gt;letter&lt;/a&gt; that Coda Hale wrote seemed to be rather well thought out. The author goes into several criticisms of Scala which seem to boil down to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Complicated concepts in the language&lt;/li&gt;
&lt;li&gt;Community support&lt;/li&gt;
&lt;li&gt;Lack of abundance of developers&lt;/li&gt;
&lt;li&gt;Reality of the Scala-and-Java nature of real world development&lt;/li&gt;
&lt;li&gt;Build toolchain issues&lt;/li&gt;
&lt;li&gt;Performance issues&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;The first point and last two are very specific to Scala. Language designers have to decide between many difficult tradeoffs when designing a language and it is hard to say which ones will pay off for their community in the long run. It is certainly difficult to see how a given choice will pay off in the long run and while some of Scala&amp;rsquo;s features he mentions seem pretty simple, others make me go cross-eyed trying to read explanations of them. Having said that, I still am very much a novice in the language and don&amp;rsquo;t feel particularly qualified to actually weigh in on these topics.&lt;/p&gt;

&lt;p&gt;The lack of developers and quality of community support can be bundled together and seem to have more to do with the age and uptake of the language than at the language itself. Any language will have bootstrapping issues similar to this. And when choosing a language, it is an important aspect that should, and to some extent can, be checked out before any major development undertaking. Evaluating a community around a technology is no easy task though. I&amp;rsquo;ve certainly been in situations where the community involvement around the technology used was unhelpful, misleading, or nonexistent; it is a crummy situation to be in. The best way to know the value of a community is to be a part of it for a while.&lt;/p&gt;

&lt;p&gt;Coda points out the fact that Yammer wasn&amp;rsquo;t really deciding between Java or Scala but between Java or Scala+Java. If we ever meet I owe Coda a beer for this. I&amp;rsquo;ve had my share of arguments with people in the past on this reality and I&amp;rsquo;m glad to see something saying it so straight forward getting the circulation this is, even if it was never supposed to. Coming from a non-Java background to a Groovy position I feel acutely aware of all the times I&amp;rsquo;ve had to dig through Java code because of an impedence mismatch between a Java concept and a Groovy one, to better understand a library that doesn&amp;rsquo;t document something well and doesn&amp;rsquo;t have a functional equivalent in Groovy, or to debug or diagnose a framework bug. Having said that, I don&amp;rsquo;t believe my team has written a new line of Java for our core product since we migrated to Groovy some number of months ago.&lt;/p&gt;

&lt;p&gt;I expect that the Java+otherLang situation is an inevitability of developing on the JVM. As long as Java is the dominant player on the platform it will be the lingua franca. The reality of these languages being so interoperable is that the cost to benefit analysis of porting a framework or library (internal or external) over to another language on the platform almost always works against porting it.&lt;/p&gt;

&lt;p&gt;In the end, Coda seems to make a lot of good points. I can&amp;rsquo;t vouch for his Scala specific concerns, but others seem reaonable in the more general case of burgeoning JVM languages. And, while this doesn&amp;rsquo;t lower my interest or intent of learning Scala one of these days I do wonder why Yammer decided to start with Scala given the resources available to them with other languages.&lt;/p&gt;

&lt;p&gt;My intention has been that were I to take a startup from day 1 I&amp;rsquo;d pick a language that I already had a team, or list of would be team members, with a strong understanding of and a good history with the community. Maybe they had that int he beginning or thought they did and that wasn&amp;rsquo;t mentioned, I certainly don&amp;rsquo;t have that information. And really, in the end, they have nearly sixty million dollars in VC funding, three million customers, and a rapidly growing revenue stream and I&amp;rsquo;m killing time waiting for my next robotics assignment to come down the pipe. I guess you can&amp;rsquo;t argue with results, hehe.&lt;/p&gt;

&lt;p&gt;Edit: Also of note is &lt;a href="http://codahale.com/the-rest-of-the-story/"&gt;Coda&amp;rsquo;s follow up&lt;/a&gt;, you should read it if you read the first.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/yammer-scala-burgeoning-languages"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/yammer-scala-burgeoning-languages#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=Hh3KhRHswac:WFjzHEjUy6U:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=Hh3KhRHswac:WFjzHEjUy6U:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=Hh3KhRHswac:WFjzHEjUy6U:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=Hh3KhRHswac:WFjzHEjUy6U:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/Hh3KhRHswac" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/yammer-scala-burgeoning-languages</feedburner:origLink></item>
    <item>
      <pubDate>Sat, 27 Aug 2011 22:31:00 -0700</pubDate>
      <title>Perl to Groovy Mappings (An Introduction)</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/XKVA_urSRrU/perl-to-groovy-mappings</link>
      <guid isPermaLink="false">http://mfollett.com/perl-to-groovy-mappings</guid>
      <description>&lt;p&gt;
	&lt;p&gt;Recently I took a job with a startup that is using Groovy as their main language. I find the language to be similar to several other languages and they have &lt;a href="http://groovy.codehaus.org/Differences+to+Other+Languages"&gt;some comparisons on their site&lt;/a&gt;, however one comparison they are missing is to Perl. Since I'm learning Groovy anyway and the two are sufficiently similar that I thought I'd give it a shot.&lt;/p&gt;
&lt;p&gt;Before I start with the articles there are a few important things to note about Groovy:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Groovy autoboxes, as such it is completely legitimate to write `"I like cheese".someMethodOnStrings()`.&lt;/li&gt;
&lt;li&gt;Groovy automatically makes a variable named `it` as the only parameter for lambda function if no parameter list is given, meaning that: `def foo = { it * 2}` is similar to `def foo = { it -&amp;gt; it * 2}`.&lt;/li&gt;
&lt;li&gt;Groovy's syntax provides an alternate way to list parameters for a method call when the last parameter is a lambda function meaning that `someData.someMethod(1,2, { it + 2})` is the same as `someData.someMethod(1,2) { it + 2}`, this is useful for methods that loop over lists, like `each`.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/perl-to-groovy-mappings"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/perl-to-groovy-mappings#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=XKVA_urSRrU:0Z-xDlZvoSs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=XKVA_urSRrU:0Z-xDlZvoSs:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=XKVA_urSRrU:0Z-xDlZvoSs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=XKVA_urSRrU:0Z-xDlZvoSs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/XKVA_urSRrU" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/perl-to-groovy-mappings</feedburner:origLink></item>
    <item>
      <pubDate>Sat, 27 Aug 2011 20:45:00 -0700</pubDate>
      <title>Perl  to Groovy Mapping (Iterating)</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/PA9OQnEQLYk/perl-groovy-cheat-sheet</link>
      <guid isPermaLink="false">http://mfollett.com/perl-groovy-cheat-sheet</guid>
      <description>&lt;p&gt;
	&lt;p&gt;This entry will primarily go over various approaches towards iterating over structures of data. This will include basic looping as well as equivalents to Perl&amp;rsquo;s &lt;code&gt;map&lt;/code&gt; &amp;amp; &lt;code&gt;grep&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is not intended to be an exhaustive guide or a best practice for either language. The attempt, as with all articles in this series, is to provide a basic set of mappings between the languages.&lt;/p&gt;

&lt;h2&gt;Iterating over collections&lt;/h2&gt;

&lt;p&gt;To loop over all the items in an array in Perl you would probably use the &lt;code&gt;for&lt;/code&gt; loop construct:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;for my $item (@array) {…}&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;You could do something similar in Groovy using the &lt;code&gt;each&lt;/code&gt; method on collections:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;list.each {&lt;span class="er"&gt;…&lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;To loop over all the keys in a hash (or Map) you can combine the above with the &lt;code&gt;keys&lt;/code&gt; builtin:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;for my $key (keys(%hash)) {…}&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;In Groovy you simply use a lambda that accepts two parameters.&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;myMap.each { key, _value -&amp;gt; &lt;span class="er"&gt;…&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Looping over all the values is similar to the examples above in both, so I will skip that. Looping over each entry in the hash with both the key and value in Groovy is the same as the example above, in Perl you would have to use &lt;code&gt;each&lt;/code&gt;, which I don&amp;rsquo;t like.&lt;/p&gt;

&lt;p&gt;It is important to note that with Groovy&amp;rsquo;s &lt;code&gt;each&lt;/code&gt; different things are passed in based on the number of parameters. The example above gave &lt;code&gt;each&lt;/code&gt; a 2 parameter lambda and so the lambda got inputs of [key, value]. Had a 1 parameter lambda been passed in then that lambda would have received an Entry object that had accessors for the key and value.&lt;/p&gt;

&lt;h2&gt;Iterating over a Set of Integers&lt;/h2&gt;

&lt;p&gt;Both Perl and Groovy provide many ways to iterate over a range. One popular approach in Perl is to use the dot-dot range operator (..) and &lt;code&gt;for&lt;/code&gt; looping construct. By using this it is simple to print all the numbers between one and ten:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;for my $num (1..10) { print $num }&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Groovy has a similar approach:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;(&lt;span class="i"&gt;1&lt;/span&gt;..&lt;span class="i"&gt;10&lt;/span&gt;).each { print &lt;span class="lv"&gt;it&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Groovy has a couple other ways to do the same thing, for example numbers have an &lt;code&gt;upto&lt;/code&gt; method attached to them that can be used to iterate. As such, the same thing above could be written as:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="i"&gt;1&lt;/span&gt;.upto(&lt;span class="i"&gt;10&lt;/span&gt;) { print &lt;span class="lv"&gt;it&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Of course, Perl also has the ability to loop via the &lt;code&gt;while&lt;/code&gt; looping construct and Groovy could loop using a &lt;code&gt;for in&lt;/code&gt; on top of what I&amp;rsquo;ve listed here.&lt;/p&gt;

&lt;p&gt;If you wanted to iterate over a set of integers that didn&amp;rsquo;t increment by one in Perl you might use &lt;code&gt;map&lt;/code&gt; and &lt;code&gt;for&lt;/code&gt; like this:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;for my $multiple_of_five ( map { $_ * 5 } 1..5) {…}&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Or you might use &lt;code&gt;grep&lt;/code&gt; and &lt;code&gt;for&lt;/code&gt; like this:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;for my $multiple_of_five ( grep { not $_ % 5 } 1..25) {…}&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Or, of course, you could pick up a useful module, like &lt;a href="https://metacpan.org/module/Math::Sequence"&gt;Math::Sequence&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In Groovy you would simply do this:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="i"&gt;5&lt;/span&gt;.step(&lt;span class="i"&gt;25&lt;/span&gt;,&lt;span class="i"&gt;5&lt;/span&gt;) {&lt;span class="er"&gt;…&lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;Mapping a List&lt;/h2&gt;

&lt;p&gt;Perl helpfully provides the &lt;code&gt;map&lt;/code&gt; builtin to easily map a list of values from one to another. For example, were a developer wanting to square all the values in a list they would:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;my @squared = map { $_**2 } @original_values&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The same thing can be performed in Groovy using the collect() method on collections:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="pt"&gt;List&lt;/span&gt; squared = originalValues.collect { &lt;span class="lv"&gt;it&lt;/span&gt;.power(&lt;span class="i"&gt;2&lt;/span&gt;) }&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;Grepping a List&lt;/h2&gt;

&lt;p&gt;Perl provides the &lt;code&gt;grep&lt;/code&gt; builtin to easily filter values out of a list and provide a new list with only the remaining values. For example, if a developer was looking for all the items in a list that were odd they could:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;my @odd = grep { $_ % 2 } @numbers&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;To do this in Groovy they would use the &lt;code&gt;findAll&lt;/code&gt; method that exists on collections:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="pt"&gt;List&lt;/span&gt; odd = numbers.findAll { &lt;span class="lv"&gt;it&lt;/span&gt; % &lt;span class="i"&gt;2&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;Grepping for the First Item in a List&lt;/h2&gt;

&lt;p&gt;Perl has a number of modules which are considered &amp;lsquo;core&amp;rsquo;. It is reasonable to assume any core module is installed and readily available. To get the first item in a list that matches some criteria a Perl developer could use the example above for grepping a list and &lt;code&gt;shift&lt;/code&gt; off the top, but more likely they would use &lt;a href="https://metacpan.org/module/List::Util"&gt;List::Util&lt;/a&gt;&amp;rsquo;s &lt;code&gt;first&lt;/code&gt; like this:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;my $first_odd = first { $_ % 2} @numbers&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;A similar approach in Groovy could be done via the &lt;code&gt;find&lt;/code&gt; method on collections:&lt;/p&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&lt;span class="kw"&gt;def&lt;/span&gt; firstOdd = numbers.find { &lt;span class="lv"&gt;it&lt;/span&gt; % &lt;span class="i"&gt;2&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/perl-groovy-cheat-sheet"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/perl-groovy-cheat-sheet#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=PA9OQnEQLYk:2iWl_chbA9w:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=PA9OQnEQLYk:2iWl_chbA9w:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=PA9OQnEQLYk:2iWl_chbA9w:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=PA9OQnEQLYk:2iWl_chbA9w:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/PA9OQnEQLYk" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/perl-groovy-cheat-sheet</feedburner:origLink></item>
    <item>
      <pubDate>Sat, 16 Oct 2010 22:24:00 -0700</pubDate>
      <title>15 Minutes of Fame</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/4-UxKz4ivWs/15-minutes-of-fame</link>
      <guid isPermaLink="false">http://mfollett.com/15-minutes-of-fame</guid>
      <description>&lt;p&gt;
	&lt;p&gt;Holy cow! &amp;nbsp;I decided to check my Google Analytics account to see what the impact of my &lt;a href="http://mfollett.com/if-you-like-x-you-might-like-perl"&gt;If You Like X You Might Like Perl&lt;/a&gt;. &amp;nbsp;I thought it might, maybe, double the visitors to this page. &amp;nbsp;I was quite wrong, here is how wrong:&lt;/p&gt;
&lt;p&gt;&lt;div class='p_embed p_image_embed'&gt;
&lt;a href="http://posterous.com/getfile/files.posterous.com/temp-2010-10-16/wCvbqhIrveBxsmtbavFrDHmiueCeJGmtaoFxercxaDzulkIjlfIfziElAlet/Screen_shot_2010-10-17_at_12.28.41_AM.png.scaled1000.png"&gt;&lt;img alt="Screen_shot_2010-10-17_at_12" height="94" src="http://posterous.com/getfile/files.posterous.com/temp-2010-10-16/wCvbqhIrveBxsmtbavFrDHmiueCeJGmtaoFxercxaDzulkIjlfIfziElAlet/Screen_shot_2010-10-17_at_12.28.41_AM.png.scaled500.png" width="500" /&gt;&lt;/a&gt;
&lt;/div&gt;
So I started looking around at what drove this traffic. &amp;nbsp;It turns out that &lt;a href="http://www.reddit.com/user/perlgeek"&gt;perlgeek&lt;/a&gt; &lt;a href="http://www.reddit.com/r/programming/comments/ds2w1/if_you_like_x_you_might_like_perl/"&gt;posted my article to reddit&lt;/a&gt;. &amp;nbsp;When I followed the referring links I found a few interesting things. &amp;nbsp;Apparently the article is the 16th most controversial at the moment. &amp;nbsp;It is below whether ads are like reality, but above some insult against redit users, some act that played out in the war in&amp;nbsp;Afghanistan, and the POTUS's policy on&amp;nbsp;cannabis:&lt;/p&gt;
&lt;p&gt;&lt;div class='p_embed p_image_embed'&gt;
&lt;a href="http://posterous.com/getfile/files.posterous.com/temp-2010-10-16/mxHormrBGetkqcCtbetqqHqkdkvvuJsGuzBvwCAmaJJBdDBoIvmqhkHcgbpi/Screen_shot_2010-10-17_at_12.30.05_AM.png.scaled1000.png"&gt;&lt;img alt="Screen_shot_2010-10-17_at_12" height="285" src="http://posterous.com/getfile/files.posterous.com/temp-2010-10-16/mxHormrBGetkqcCtbetqqHqkdkvvuJsGuzBvwCAmaJJBdDBoIvmqhkHcgbpi/Screen_shot_2010-10-17_at_12.30.05_AM.png.scaled500.png" width="500" /&gt;&lt;/a&gt;
&lt;/div&gt;
It is also 24th on top scoring links in the programming category, but there aren't any interesting juxtapositions so I'm not providing a screenshot. &amp;nbsp;Honestly, I find the whole thing so amusing that I don't mind that the link has received more negative votes than positive ones or that 4 of the 5 comments are either negative, useless, or both. &amp;nbsp;The fifth is asking if one of the other commenters actually read the article, which is really neither positive nor negative.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/15-minutes-of-fame"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/15-minutes-of-fame#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=4-UxKz4ivWs:mUwTeerCjuo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=4-UxKz4ivWs:mUwTeerCjuo:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=4-UxKz4ivWs:mUwTeerCjuo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=4-UxKz4ivWs:mUwTeerCjuo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/4-UxKz4ivWs" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
      <media:content type="image/png" height="158" width="844" url="http://getfile3.posterous.com/getfile/files.posterous.com/temp-2010-10-16/wCvbqhIrveBxsmtbavFrDHmiueCeJGmtaoFxercxaDzulkIjlfIfziElAlet/Screen_shot_2010-10-17_at_12.28.41_AM.png">
        <media:thumbnail height="94" width="500" url="http://getfile9.posterous.com/getfile/files.posterous.com/temp-2010-10-16/wCvbqhIrveBxsmtbavFrDHmiueCeJGmtaoFxercxaDzulkIjlfIfziElAlet/Screen_shot_2010-10-17_at_12.28.41_AM.png.scaled500.png" />
      </media:content>
      <media:content type="image/png" height="634" width="1114" url="http://getfile0.posterous.com/getfile/files.posterous.com/temp-2010-10-16/mxHormrBGetkqcCtbetqqHqkdkvvuJsGuzBvwCAmaJJBdDBoIvmqhkHcgbpi/Screen_shot_2010-10-17_at_12.30.05_AM.png">
        <media:thumbnail height="285" width="500" url="http://getfile7.posterous.com/getfile/files.posterous.com/temp-2010-10-16/mxHormrBGetkqcCtbetqqHqkdkvvuJsGuzBvwCAmaJJBdDBoIvmqhkHcgbpi/Screen_shot_2010-10-17_at_12.30.05_AM.png.scaled500.png" />
      </media:content>
    <feedburner:origLink>http://mfollett.com/15-minutes-of-fame</feedburner:origLink></item>
    <item>
      <pubDate>Sat, 16 Oct 2010 08:52:00 -0700</pubDate>
      <title>The Unity Model</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/JRiL2riR_cw/the-unity-model</link>
      <guid isPermaLink="false">http://mfollett.com/the-unity-model</guid>
      <description>&lt;p&gt;
	&lt;p&gt;I'm reading &lt;a href="http://www.amazon.com/gp/product/0201058669?ie=UTF8&amp;amp;tag=mfollettcom-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0201058669"&gt;Parallel Programming Design: &amp;nbsp;A Foundation by Chandy and Misra&lt;/a&gt; for a master's class and am finding it very interesting. &amp;nbsp;The book covers the Unity Model as an approach towards parallel programming. &amp;nbsp;The language used to model solutions to a problem isn't meant to be directly implemented as a language (though it has been incarnated as &lt;a href="http://www.osti.gov/bridge/servlets/purl/5955653-tcrAK9/5955653.pdf"&gt;PCN&lt;/a&gt;) but instead to be used as a model for implementing the solution in some other language. &amp;nbsp;It is a fun language and hopefully now that I don't have a presentation looming over my head I can explore it independently and post some example.&lt;/p&gt;
&lt;p&gt;The language is broken up into several parts:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Declare - used for declaring variables&lt;/li&gt;
&lt;li&gt;Always - used for defining functions&lt;/li&gt;
&lt;li&gt;Initially - used for initializing variables&lt;/li&gt;
&lt;li&gt;Assign - the main portion of the code&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The reason why initialization doesn't happen in the main portion of the code is that there is no guarantee that it would happen when you would want or that it would only happen once. &amp;nbsp;In fact, the assignment section of the program has very weak promises. &amp;nbsp;It only guarantees that when the program is executing any given line that any other line will eventually be executed if the program is run forever. &amp;nbsp;Other than that it just randomly picks statements to execute.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;By the way, the book has been out of print for a while now, so it isn't the easiest to find for cheap and is impossible to find new. &amp;nbsp;I ordered it three times used from third parties before someone finally actually had it in stock and shipped it to me.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/the-unity-model"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/the-unity-model#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=JRiL2riR_cw:eR7K0mPyQyk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=JRiL2riR_cw:eR7K0mPyQyk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=JRiL2riR_cw:eR7K0mPyQyk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=JRiL2riR_cw:eR7K0mPyQyk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/JRiL2riR_cw" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/the-unity-model</feedburner:origLink></item>
    <item>
      <pubDate>Sat, 16 Oct 2010 08:10:00 -0700</pubDate>
      <title>7 Languages in 7 Weeks in St. Louis</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/KjB5p7MxGQk/7-languages-in-7-weeks-st-louis</link>
      <guid isPermaLink="false">http://mfollett.com/7-languages-in-7-weeks-st-louis</guid>
      <description>&lt;p&gt;
	&lt;p&gt;One of the guys at the Genome Center mentioned he wanted to get a 7 Languages in 7 Weeks group started in St. Louis to go through the languages. &amp;nbsp;I thought that was a neat idea, but I also realized it was very simple and may not require a group.&lt;/p&gt;
&lt;p&gt;If you look at the list that Tate provides for &lt;a href="http://www.amazon.com/dp/193435659X?tag=mfollettcom-20&amp;amp;camp=213381&amp;amp;creative=390973&amp;amp;linkCode=as4&amp;amp;creativeASIN=193435659X&amp;amp;adid=0PAPM4C2W0RA1YW6J762&amp;amp;"&gt;Tate's book&lt;/a&gt;, he lists these languages:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ruby&lt;/li&gt;
&lt;li&gt;Io&lt;/li&gt;
&lt;li&gt;Scala&lt;/li&gt;
&lt;li&gt;Erlang&lt;/li&gt;
&lt;li&gt;Clojure&lt;/li&gt;
&lt;li&gt;Haskell&lt;/li&gt;
&lt;li&gt;Prolog&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you look at &lt;a href="http://www.sluug.org/resources/calendar/"&gt;SLUUG's St. Louis Event Calendar&lt;/a&gt; you find that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://groups.google.com/group/stlruby/about"&gt;Ruby&lt;/a&gt; - Meets 2nd Monday of the Month&lt;/li&gt;
&lt;li&gt;Io&lt;/li&gt;
&lt;li&gt;Scala&lt;/li&gt;
&lt;li&gt;&lt;a href="http://groups.google.com/group/erlang-colearning"&gt;Erlang&lt;/a&gt; - Is now dead due to lack if interest, but could be resurected (I know since I ran it :) )&lt;/li&gt;
&lt;li&gt;&lt;a href="http://clojurecljub.wordpress.com/"&gt;Clojure&lt;/a&gt;&amp;nbsp;- Meets 4th Thursday of the month&lt;/li&gt;
&lt;li&gt;Haskell - Had its first social, maybe it can take off with meetings soon&lt;/li&gt;
&lt;li&gt;Prolog&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sadly, we don't have a Scala, Io, or Prolog group that I know. &amp;nbsp;However, I bet that we could get people to volunteer for such talks in &lt;a href="http://www.lambdalounge.com"&gt;Lambda Lounge&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As an addendum, if STLRUBY didn't want to do a session I'm sure &lt;a href="http://stlouis.pm.org"&gt;St. Louis Perl Mongers&lt;/a&gt; would be willing to shift around their schedule to do a talk on dynamic typing and meta programming.&lt;/p&gt;
&lt;p&gt;&lt;iframe marginheight="0" scrolling="no" marginwidth="0" src="http://rcm.amazon.com/e/cm?lt1=_blank&amp;bc1=000000&amp;IS2=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=mfollettcom-20&amp;o=1&amp;p=8&amp;l=as1&amp;m=amazon&amp;f=ifr&amp;md=10FE9736YVPPT7A0FBG2&amp;asins=193435659X" frameborder="0" style="height: 240px;"&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/7-languages-in-7-weeks-st-louis"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/7-languages-in-7-weeks-st-louis#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=KjB5p7MxGQk:ol0S2VJLZkI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=KjB5p7MxGQk:ol0S2VJLZkI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=KjB5p7MxGQk:ol0S2VJLZkI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=KjB5p7MxGQk:ol0S2VJLZkI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/KjB5p7MxGQk" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/7-languages-in-7-weeks-st-louis</feedburner:origLink></item>
    <item>
      <pubDate>Sat, 16 Oct 2010 07:28:00 -0700</pubDate>
      <title>If You Like X, You Might Like Perl</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/rBnmFn_a40k/if-you-like-x-you-might-like-perl</link>
      <guid isPermaLink="false">http://mfollett.com/if-you-like-x-you-might-like-perl</guid>
      <description>&lt;p&gt;
	&lt;p&gt;&lt;strong&gt;Objective-C &lt;/strong&gt;- You'd probably like &lt;a href="http://search.cpan.org/~drolsky/Moose-1.15/lib/Moose/Manual.pod"&gt;Moose&lt;/a&gt;'s concept of &lt;a href="http://search.cpan.org/~drolsky/Moose-1.15/lib/Moose/Role.pm"&gt;roles&lt;/a&gt;&amp;nbsp;if you like categories. &amp;nbsp;Roles also provide the ability to require methods exist on classes so you could use them for interfaces too, but when you consume a role you can't guarantee it won't add functionality.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Clojure&lt;/strong&gt;&amp;nbsp;- If you were willing to play with &lt;a href="http://rakudo.org/how-to-get-rakudo"&gt;Perl 6&lt;/a&gt; you'd probably like the many of its lazy aspects. &amp;nbsp;The common example being binding an infinitely long fib sequence to a list (my @fib := 0,1,*+*...* ). &amp;nbsp;Perl 6 also supports multi-method dispatching and pattern matching. &amp;nbsp;I don't know about Clojure's pattern matching abilities, but I do know that Perl 6's is weaker than Erlang's, so be aware of that.&lt;/p&gt;
&lt;p&gt;If you don't want to try Perl 6 you should look at the Higher Order Perl book. &amp;nbsp;It focuses on functional Perl and steals heavily from Lisp. &amp;nbsp;In fact, the author states very early on that of the &lt;a href="http://www.paulgraham.com/diff.html"&gt;7 things that make Lisp different&lt;/a&gt;,&amp;nbsp;Perl has 6. &amp;nbsp;It is available &lt;a href="http://hop.perl.plover.com/book/#PDF"&gt;free online&lt;/a&gt;&amp;nbsp;or from a book store. &amp;nbsp;The author is currently boycotting Amazon though, so while they sell it you may want to buy from someone else.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ruby&lt;/strong&gt; - I haven't gotten around to learning Ruby. &amp;nbsp;For what it's worth, there are a lot of people I know that like both Ruby and Perl so I have to assume there are some good&amp;nbsp;similarities. &amp;nbsp;If you are looking for method_missing it is called autoload. &amp;nbsp;Besides that, &lt;a href="http://search.cpan.org/~drolsky/Moose-1.15/lib/Moose/Exporter.pm"&gt;Moose::Exporter&lt;/a&gt; is great for making keywords for DSLs. &amp;nbsp;You can use Perl 5's &lt;a href="http://perldoc.perl.org/perlsub.html#Prototypes"&gt;prototypes&lt;/a&gt;, but that gets a little more complicated. &amp;nbsp;You can also use &lt;a href="http://search.cpan.org/~flora/Devel-Declare-0.006000/lib/Devel/Declare.pm"&gt;Devel::Declare&lt;/a&gt; if you just want to take the parser over altogether which, of course, is gets more complicated.&lt;/p&gt;
&lt;p&gt;Feel free to add more in the comments or tell me where I'm wrong, I'll update the body of the post as the conversation goes along.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/if-you-like-x-you-might-like-perl"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/if-you-like-x-you-might-like-perl#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=rBnmFn_a40k:oCOy3LRfkNc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=rBnmFn_a40k:oCOy3LRfkNc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=rBnmFn_a40k:oCOy3LRfkNc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=rBnmFn_a40k:oCOy3LRfkNc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/rBnmFn_a40k" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/if-you-like-x-you-might-like-perl</feedburner:origLink></item>
    <item>
      <pubDate>Wed, 13 Oct 2010 23:12:00 -0700</pubDate>
      <title>Finalized Perl 6 Talk Slides</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/hLV_LAF8fRI/finalized-perl-6-talk-slides</link>
      <guid isPermaLink="false">http://mfollett.com/finalized-perl-6-talk-slides</guid>
      <description>&lt;p&gt;
	&lt;p&gt;In a little over 12 hours I will be giving my Perl 6 talk at Strange Loop. &amp;nbsp;I have provided the finalized slides below. &amp;nbsp;Hopefully in the next week I will have an audio overlay on these slides so you can hear how badly I mess up. :)&lt;/p&gt;
&lt;p&gt;&lt;iframe marginheight="0" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/5439555" marginwidth="0" frameborder="0" height="417" width="500"&gt;&lt;/iframe&gt;&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/finalized-perl-6-talk-slides"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/finalized-perl-6-talk-slides#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=hLV_LAF8fRI:x1IclbDPRNI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=hLV_LAF8fRI:x1IclbDPRNI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=hLV_LAF8fRI:x1IclbDPRNI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=hLV_LAF8fRI:x1IclbDPRNI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/hLV_LAF8fRI" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/finalized-perl-6-talk-slides</feedburner:origLink></item>
    <item>
      <pubDate>Tue, 12 Oct 2010 23:16:00 -0700</pubDate>
      <title>Perl 6 Talk - Sneak Peak</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/J-rBAmAylAs/perl-6-talk</link>
      <guid isPermaLink="false">http://mfollett.com/perl-6-talk</guid>
      <description>&lt;p&gt;
	&lt;p&gt;This week's post is late and a copout. &amp;nbsp;Instead of actually writing an article I'm posting the slides to the talk I'll be giving this Thursday. &amp;nbsp;I will be a speaker at &lt;a href="http://www.strangeloop2010.com"&gt;Strange Loop 2010&lt;/a&gt;&amp;nbsp;in beautiful St. Louis, MO. &amp;nbsp;The talk will be about Perl 6 and will be predominantly geared towards people who do not know Perl 5 or Perl 6 but are interested in exploring new languages. My intent is to give people a brief history lesson and then show them enough neat features about the language that they'll want to go pick up more. &amp;nbsp;More info &lt;a href="http://strangeloop2010.com/talks/14492"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you have any comments, criticism or suggestions please don't hesitate to post them. &amp;nbsp;I would greatly appreciate it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;iframe marginheight="0" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/5429997" marginwidth="0" frameborder="0" height="417" width="500"&gt;&lt;/iframe&gt;&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/perl-6-talk"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/perl-6-talk#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=J-rBAmAylAs:R69ed9Mtnd8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=J-rBAmAylAs:R69ed9Mtnd8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=J-rBAmAylAs:R69ed9Mtnd8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=J-rBAmAylAs:R69ed9Mtnd8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/J-rBAmAylAs" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/perl-6-talk</feedburner:origLink></item>
    <item>
      <pubDate>Wed, 06 Oct 2010 07:31:41 -0700</pubDate>
      <title>Dancer Presentation</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/hHis1KhmDIE/dancer-presentation</link>
      <guid isPermaLink="false">http://mfollett.com/dancer-presentation</guid>
      <description>&lt;p&gt;
	SawyerX presented on the exciting new Perl web framework Dancer at a Python meeting. &amp;nbsp;The slides are very informative, I recommend looking over them.&lt;p /&gt;&lt;div&gt;&lt;iframe marginheight="0" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/8833888" marginwidth="0" frameborder="0" height="417" width="500"&gt;&lt;/iframe&gt;&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/dancer-presentation"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/dancer-presentation#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=hHis1KhmDIE:XaJYj3GOmSI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=hHis1KhmDIE:XaJYj3GOmSI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=hHis1KhmDIE:XaJYj3GOmSI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=hHis1KhmDIE:XaJYj3GOmSI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/hHis1KhmDIE" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/dancer-presentation</feedburner:origLink></item>
    <item>
      <pubDate>Sun, 03 Oct 2010 20:41:00 -0700</pubDate>
      <title>Perl 6: Exciting Method Invocation</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/DNLAmaxXc9M/perl-6-exciting-method-invocation</link>
      <guid isPermaLink="false">http://mfollett.com/perl-6-exciting-method-invocation</guid>
      <description>&lt;p&gt;
	&lt;p&gt;Perl 6 provides many new and interesting approaches to method invocation. &amp;nbsp;New constructs in the language allow the developer to define how many matching methods are called, how they are called, as well as a few other things.&lt;/p&gt;
&lt;h3&gt;In Line Mutators&lt;/h3&gt;
&lt;p&gt;Perl 6 supports the idea of inline mutators. &amp;nbsp;In Perl 5 it isn't too uncommon to see code like this:&lt;/p&gt;
&lt;blockquote class="posterous_short_quote"&gt;
&lt;p&gt;@array = sort @array&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It is common enough in the Perl community to see "assign this mutated value back into the variable it came from" that Perl 6 gives a cleaner way. &amp;nbsp;The same code in Perl 6 could be written:&lt;/p&gt;
&lt;blockquote class="posterous_short_quote"&gt;
&lt;p&gt;@array .= sort&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The line above says to take @array, sort it, and put the values back in @array all in one fluid motion. &amp;nbsp;Of course, there is one motion that developers go through that is so common most probably don't think about it:&lt;/p&gt;
&lt;blockquote class="posterous_short_quote"&gt;
&lt;p&gt;my SVG $svg_serializer = SVG.new;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Thankfully, .= can use used here to assign a value into $svg_serializer more cleanly:&lt;/p&gt;
&lt;blockquote style="margin-top: 10px; margin-left: 1px; border-left-width: 4px !important; border-left-style: solid !important; border-left-color: #dddddd !important; padding-left: 10px;"&gt;
&lt;p&gt;my SVG $svg_serializer .= new;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Invoking Multiple Matched Methods&lt;/h3&gt;
&lt;p&gt;In Perl5 (and other languages) one often finds code litered with statements like this:&lt;/p&gt;
&lt;blockquote class="posterous_short_quote"&gt;
&lt;p&gt;$foo-&amp;gt;frobinicate() if $foo-&amp;gt;can('frobinicate');&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That gets old after a while. &amp;nbsp;Perl 6 solves this, and a few other problems, with a new approach to method calls that allows the developer to request 0 or 1, 1, 1 or more, or any number of methods be called at a time. &amp;nbsp;So, for example, the Perl6 equivalent of above is:&lt;/p&gt;
&lt;blockquote class="posterous_short_quote"&gt;
&lt;p&gt;$foo.?frobinicate;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The above code will invoke the frobinicate method on $foo if one exists. &amp;nbsp;However, if no method exists that matches that criteria then nothing will be executed and instead of dying the statement simply returns Nil.&lt;/p&gt;
&lt;p&gt;As I mentioned there are other options here also, for example if the developer wanted to execute all of the 'frobinicate's that existed within the inheritance hierarchy of $foo they could do either:&lt;/p&gt;
&lt;blockquote class="posterous_short_quote"&gt;
&lt;p&gt;$foo.*frobinicate;&lt;/p&gt;
&lt;p&gt;$foo.+frobinicate;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;As readers can probably guess '.*' will invoke 0 or more methods named 'frobinicate' on $foo returning Nill if none exist. &amp;nbsp;That leaves '.+' to invoke 1 or more matching methods, the line dies if it finds no matching methods.&lt;/p&gt;
&lt;p&gt;Here is an example of the above:&lt;/p&gt;
&lt;blockquote class="posterous_medium_quote"&gt;
&lt;p&gt;class Dog {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; method talk { 'bark' }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;class TalkingDog is Dog {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; method talk { 'Hello' }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;my TalkingDog $td .= new;&lt;/p&gt;
&lt;p&gt;$td.talk # returns 'Hello'&lt;/p&gt;
&lt;p&gt;$td.?talk # returns 'Hello'&lt;/p&gt;
&lt;p&gt;$td.*talk # returns ('Hello', 'bark')&lt;/p&gt;
&lt;p&gt;$td.+talk # also returns ('Hello', 'bark')&lt;/p&gt;
&lt;p&gt;$td.*calculate_pi # returns Nil&lt;/p&gt;
&lt;p&gt;$td.+calculate_pi # dies&lt;/p&gt;
&lt;p&gt;$td.?calculate_pi # returns Nil&lt;/p&gt;
&lt;p&gt;$td.calculate_pi # dies&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Parallel Invokation&lt;/h3&gt;
&lt;p&gt;Perl 6 has an incredibly exciting new operator called the hyperoperator. &amp;nbsp;The hyperoperator indicates that the methods being invoked can be dispatched in parallel. &amp;nbsp;This makes simple cases of parallel execution very simple to do. &amp;nbsp;To do this, simply prepend '&amp;gt;&amp;gt;' between the object and the invocation operator. &amp;nbsp;For example:&lt;/p&gt;
&lt;blockquote class="posterous_short_quote"&gt;
&lt;p&gt;@foo&amp;gt;&amp;gt;.frobinicate&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This would invoke 'frobinicate' on all the elements in @foo in parallel. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The hyperoperator can be combined with the previous topic of invoking all the methods that match. &amp;nbsp;This makes it very simple to invoke all of the possible methods on an object in parallel:&lt;/p&gt;
&lt;blockquote class="posterous_short_quote"&gt;
&lt;p&gt;$foo&amp;gt;&amp;gt;.*frobinicate()&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Here is a simple, but more fleshed out example to wrap things up:&lt;/p&gt;
&lt;blockquote class="posterous_medium_quote"&gt;
&lt;p&gt;class Department {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; has @.employees;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; has $.name;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; method gen_print_info { return "$.name:\n" ~"\t\t" ~ @.employees.sort.join(', ')}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;my @company = (&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Department.new( name =&amp;gt; 'Accounting', 'employees' =&amp;gt; &amp;lt;Jeff Jane Susan&amp;gt;),&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Department.new( name =&amp;gt; 'Security', employees =&amp;gt; &amp;lt;Alice Bob&amp;gt;),&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Department.new( name =&amp;gt; 'Marketing', employees =&amp;gt; &amp;lt;Margaret Terry Lawrence&amp;gt;),&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Department.new( name =&amp;gt; 'Development', employees =&amp;gt; &amp;lt;Matt Fred Steve Joe Alith Jie&amp;gt;)&lt;/p&gt;
&lt;p&gt;)&lt;/p&gt;
&lt;p&gt;my @print_info = @company&amp;gt;&amp;gt;.gen_print_info;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The example above would execute gen_print_info on all of the Department typed objects in @company.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Further Reading&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://perlcabal.org/syn/S12.html"&gt;Synopsis 12 - Objects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Patrick Michaud's &lt;a href="http://pmichaud.com/2010/pres/yapcna-perl6/slides/start.html"&gt;Cool Perl 6&lt;/a&gt;&amp;nbsp;has some neat examples&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/perl-6-exciting-method-invocation"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/perl-6-exciting-method-invocation#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=DNLAmaxXc9M:gYuHiQNK__Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=DNLAmaxXc9M:gYuHiQNK__Q:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=DNLAmaxXc9M:gYuHiQNK__Q:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=DNLAmaxXc9M:gYuHiQNK__Q:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/DNLAmaxXc9M" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/perl-6-exciting-method-invocation</feedburner:origLink></item>
    <item>
      <pubDate>Sun, 03 Oct 2010 20:29:00 -0700</pubDate>
      <title>The Lacuna Expanse</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/UCQc5201P-M/the-lacuna-expanse</link>
      <guid isPermaLink="false">http://mfollett.com/the-lacuna-expanse</guid>
      <description>&lt;p&gt;
	&lt;p&gt;Hey readers,&lt;/p&gt;
&lt;p&gt;Have you looked at &lt;a href="http://www.lacunaexpanse.com/"&gt;The Lacuna Expanse&lt;/a&gt;? &amp;nbsp;I'm afraid I just burned an hour of time playing it instead of doing other things. &amp;nbsp;It's a pretty neat MMO that combines strategy and SimCity in a fun game with a galactic theme. &amp;nbsp;I was surprised to see how well it is put together for being web based. &amp;nbsp;I'd really recommend checking it out.&lt;/p&gt;
&lt;p&gt;If you aren't interested in the game then you might be interested in the tech behind it. The whole thing is written in Perl and uses a lot of fun tech. &amp;nbsp;Here is a &lt;a href="http://www.madmongers.org/talks/the-lacuna-expanse"&gt;slide deck&lt;/a&gt;.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/the-lacuna-expanse"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/the-lacuna-expanse#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=UCQc5201P-M:-mopd34xbmw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=UCQc5201P-M:-mopd34xbmw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=UCQc5201P-M:-mopd34xbmw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=UCQc5201P-M:-mopd34xbmw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/UCQc5201P-M" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/the-lacuna-expanse</feedburner:origLink></item>
    <item>
      <pubDate>Sun, 03 Oct 2010 20:19:00 -0700</pubDate>
      <title>Change in Format</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/77TPFTdk-VU/change-in-format</link>
      <guid isPermaLink="false">http://mfollett.com/change-in-format</guid>
      <description>&lt;p&gt;
	&lt;p&gt;I had a request that I not use gist.github to host the code snippets. &amp;nbsp;I guess it was a trouble for people who turned off JavaScript. &amp;nbsp;Since github does not currently support Perl 6 syntax highlighting I will inline my code snippets. &amp;nbsp;However, when github supports Perl 6 syntax highlighting I will probably go back to hosting on there. &amp;nbsp;If you have an opinion on this please let me know via email, the comments, or buying me a beer and saying what you think.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/change-in-format"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/change-in-format#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=77TPFTdk-VU:eEZpGHgDh6c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=77TPFTdk-VU:eEZpGHgDh6c:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=77TPFTdk-VU:eEZpGHgDh6c:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=77TPFTdk-VU:eEZpGHgDh6c:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/77TPFTdk-VU" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/change-in-format</feedburner:origLink></item>
    <item>
      <pubDate>Sun, 26 Sep 2010 18:27:00 -0700</pubDate>
      <title>Perl 6: Coding with Class</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/9BPnw11Ojis/perl-6-coding-with-class</link>
      <guid isPermaLink="false">http://mfollett.com/perl-6-coding-with-class</guid>
      <description>&lt;p&gt;
	&lt;p&gt;This entry will focus on creating and using classes in Perl 6. &amp;nbsp;Perl 6's class system greatly expands on the approach of Perl 5 in many ways, a few of which are giving a standard &lt;em&gt;new&lt;/em&gt; method and providing an approach for easily declaring attributes on a class.&lt;/p&gt;
&lt;p&gt;Here is a very simple example of a Perl 6 class:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-text"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;span rel="#L6" id="L6"&gt;6&lt;/span&gt;
&lt;span rel="#L7" id="L7"&gt;7&lt;/span&gt;
&lt;span rel="#L8" id="L8"&gt;8&lt;/span&gt;
&lt;span rel="#L9" id="L9"&gt;9&lt;/span&gt;
&lt;span rel="#L10" id="L10"&gt;10&lt;/span&gt;
&lt;span rel="#L11" id="L11"&gt;11&lt;/span&gt;
&lt;span rel="#L12" id="L12"&gt;12&lt;/span&gt;
&lt;span rel="#L13" id="L13"&gt;13&lt;/span&gt;
&lt;span rel="#L14" id="L14"&gt;14&lt;/span&gt;
&lt;span rel="#L15" id="L15"&gt;15&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;class Animal&lt;/div&gt;&lt;div class="line" id="LC2"&gt;{&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has Str $.name;&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;method eat( $food )&lt;/div&gt;&lt;div class="line" id="LC6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div class="line" id="LC7"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;say &amp;quot;$.name is eating some $food&amp;quot;;&lt;/div&gt;&lt;div class="line" id="LC8"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div class="line" id="LC9"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC10"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;method sleep($self:)&lt;/div&gt;&lt;div class="line" id="LC11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div class="line" id="LC12"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;say $self.name ~ &amp;#39; is sleeping.&amp;#39;;&lt;/div&gt;&lt;div class="line" id="LC13"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div class="line" id="LC14"&gt;}&lt;/div&gt;&lt;div class="line" id="LC15"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;This example shows a few basic concepts. &amp;nbsp;First there is the new &lt;em&gt;class&lt;/em&gt;&amp;nbsp;keyword. &amp;nbsp;Named classes can easily be declared in one of two ways. &amp;nbsp;The example above, with curly braces, is useful when defining more than one class in a file or providing for some code to execute outside of the scope of the class when loading. &amp;nbsp;Without the curly braces is also legal, however it means that the rest of the file is the class definition.&lt;/p&gt;
&lt;p&gt;Additionally, this shows our first attribute, name. &amp;nbsp;The name attribute is defined as being of type Str. &amp;nbsp;The twigil '.' in this case indicates that this attribute should have a public accessor. &amp;nbsp;In this case that accessor is read-only because we did not define it otherwise (see below).&lt;/p&gt;
&lt;p&gt;The eat and sleep method were also defined. &amp;nbsp;The sleep method uses the name attribute on the class in the string that it says. &amp;nbsp;It can do this without using $self because $. implies the object the method was invoked on. &amp;nbsp;So, the eat method could have also been rewritten like it is for the sleep method.&lt;/p&gt;
&lt;p&gt;Instantiating new objects of type Animal and using their methods is simple:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-perl"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$dog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Animal&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;Leela&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&lt;span class="nv"&gt;$dog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;dog food&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&lt;span class="nv"&gt;$dog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;A more complicated example is below. &amp;nbsp;In this one two more classes, 'Dog' and 'Tail', have been defined:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-text"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;span rel="#L6" id="L6"&gt;6&lt;/span&gt;
&lt;span rel="#L7" id="L7"&gt;7&lt;/span&gt;
&lt;span rel="#L8" id="L8"&gt;8&lt;/span&gt;
&lt;span rel="#L9" id="L9"&gt;9&lt;/span&gt;
&lt;span rel="#L10" id="L10"&gt;10&lt;/span&gt;
&lt;span rel="#L11" id="L11"&gt;11&lt;/span&gt;
&lt;span rel="#L12" id="L12"&gt;12&lt;/span&gt;
&lt;span rel="#L13" id="L13"&gt;13&lt;/span&gt;
&lt;span rel="#L14" id="L14"&gt;14&lt;/span&gt;
&lt;span rel="#L15" id="L15"&gt;15&lt;/span&gt;
&lt;span rel="#L16" id="L16"&gt;16&lt;/span&gt;
&lt;span rel="#L17" id="L17"&gt;17&lt;/span&gt;
&lt;span rel="#L18" id="L18"&gt;18&lt;/span&gt;
&lt;span rel="#L19" id="L19"&gt;19&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;class Tail&lt;/div&gt;&lt;div class="line" id="LC2"&gt;{&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;method wag()&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;say &amp;quot;swish, swish, swish&amp;quot;;&lt;/div&gt;&lt;div class="line" id="LC6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div class="line" id="LC7"&gt;}&lt;/div&gt;&lt;div class="line" id="LC8"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC9"&gt;class Dog is Animal&lt;/div&gt;&lt;div class="line" id="LC10"&gt;{&lt;/div&gt;&lt;div class="line" id="LC11"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has Str $.tag is rw;&lt;/div&gt;&lt;div class="line" id="LC12"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;has Tail $!tail handles &amp;#39;wag&amp;#39; = Tail.new();&lt;/div&gt;&lt;div class="line" id="LC13"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC14"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;method bark()&lt;/div&gt;&lt;div class="line" id="LC15"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div class="line" id="LC16"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;say &amp;quot;woof, woof!&amp;quot;;&lt;/div&gt;&lt;div class="line" id="LC17"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div class="line" id="LC18"&gt;}&lt;/div&gt;&lt;div class="line" id="LC19"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;The Dog class has a couple new interesting additions. &amp;nbsp;The first thing to notice is that Dog inherits from Animal via the is keyword on the first line. &amp;nbsp;The &lt;em&gt;tag&lt;/em&gt; attribute is defined as 'rw'. &amp;nbsp;This means that public accessors for both acquiring and mutating the value of the tag are provided. &amp;nbsp;The &lt;em&gt;tail &lt;/em&gt;attribute has a '!' as a twigil. &amp;nbsp;This twigil indicates that no public accessors should be defined. &amp;nbsp;However, an instance of the Dog class delegates to the tail attribute when the wag method is invoked upon it. &amp;nbsp;This means that when someone calls $a_dog.wag they are really calling wag on $a_dog's $!tail. &amp;nbsp;Delegation is a very handy way to improve code reuse, Perl 5 developers who use &lt;a href="http://search.cpan.org/~drolsky/Moose-1.14/lib/Moose.pm"&gt;M&amp;oslash;&amp;oslash;se&lt;/a&gt; should be familiar with it. &amp;nbsp;Finally the tail also has a default value of a new Tail object.&lt;/p&gt;
&lt;p&gt;This new class can be easily used like the following example:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-perl"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;span rel="#L6" id="L6"&gt;6&lt;/span&gt;
&lt;span rel="#L7" id="L7"&gt;7&lt;/span&gt;
&lt;span rel="#L8" id="L8"&gt;8&lt;/span&gt;
&lt;span rel="#L9" id="L9"&gt;9&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;&lt;span class="nv"&gt;$leela&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;dog food&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&lt;span class="nv"&gt;$leela&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bark&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&lt;span class="nv"&gt;$leela&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;eat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#39;grass&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$old_tag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$leela&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tag&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC6"&gt;&lt;span class="nv"&gt;$leela&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;Leela Follett&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC7"&gt;&lt;span class="nv"&gt;$leela&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wag&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC8"&gt;&lt;span class="n"&gt;say&lt;/span&gt; &lt;span class="nv"&gt;$leela&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;\&amp;#39;s tag said &amp;#39;&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="nv"&gt;$old_tag&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="s"&gt;&amp;#39;, now it says &amp;#39;&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="nv"&gt;$leela&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tag&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC9"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;However, what if we didn't want to use the simple Tail class for our dog's tail. &amp;nbsp;We could pass in an object of another class that had a wag method on it like so:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-text"&gt;
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;span rel="#L6" id="L6"&gt;6&lt;/span&gt;
&lt;span rel="#L7" id="L7"&gt;7&lt;/span&gt;
&lt;span rel="#L8" id="L8"&gt;8&lt;/span&gt;
&lt;span rel="#L9" id="L9"&gt;9&lt;/span&gt;
&lt;span rel="#L10" id="L10"&gt;10&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;class ClumsyTail is Tail&lt;/div&gt;&lt;div class="line" id="LC2"&gt;{&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;method wag()&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;say &amp;quot;knocked over a vase.&amp;quot;;&lt;/div&gt;&lt;div class="line" id="LC6"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;&lt;div class="line" id="LC7"&gt;}&lt;/div&gt;&lt;div class="line" id="LC8"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC9"&gt;my $jewel = Dog.new( name =&amp;gt; &amp;#39;Jewel&amp;#39;, tail =&amp;gt; ClumsyTail.new() );&lt;/div&gt;&lt;div class="line" id="LC10"&gt;$jewel.wag();&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;That pretty much wraps up this entry on Perl 6's class system. &amp;nbsp;The system includes many more powerful features that should be covered at a later date.&lt;/p&gt;
&lt;p&gt;Further Reading:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://perlcabal.org/syn/S12.html"&gt;Synopsis 12: Objects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://search.cpan.org/~drolsky/Moose-1.14/lib/Moose.pm"&gt;Moose&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://github.com/perl6/book/downloads"&gt;Using Perl 6&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/perl-6-coding-with-class"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/perl-6-coding-with-class#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=9BPnw11Ojis:dmhGwaCznCc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=9BPnw11Ojis:dmhGwaCznCc:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=9BPnw11Ojis:dmhGwaCznCc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=9BPnw11Ojis:dmhGwaCznCc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/9BPnw11Ojis" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/perl-6-coding-with-class</feedburner:origLink></item>
    <item>
      <pubDate>Sun, 19 Sep 2010 19:00:00 -0700</pubDate>
      <title>Week 4:  Currying</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/uMNRjnzeBIA/week-3-currying</link>
      <guid isPermaLink="false">http://mfollett.com/week-3-currying</guid>
      <description>&lt;p&gt;
	&lt;p&gt;This week we'll be covering the process of partially applying parameters to a subroutine, this is based off of closures which we covered last week. &amp;nbsp;This allows us to create new subroutines that we can pass around that already have some of their parameters defined. &amp;nbsp;One of the benefits of this is that we don't have to pass around a parameter list and wait until all the parameters are ready, instead we can apply each parameter as we get it and then execute the subroutine at some later time when we are ready. &amp;nbsp;Doing this in Perl is actually very simple.&lt;/p&gt;
&lt;p&gt;
&lt;script src="http://gist.github.com/556982.js?file=fpblog-week3a.pl"&gt;&lt;/script&gt;
&lt;/p&gt;
&lt;p&gt;The function above provides us the ability to curry other functions. &amp;nbsp;Analyzing it shows that all we are doing is creating a new anonymous function that is going to call the function we passed in with the parameters we passed in and the parameters it receives. &amp;nbsp;Let's see an example of how this would work.&lt;/p&gt;
&lt;p&gt;
&lt;script src="http://gist.github.com/556983.js?file=fpblog-week3b.pl"&gt;&lt;/script&gt;
&lt;/p&gt;
&lt;p&gt;So, let's look at how it all worked. &amp;nbsp;First, we made a new anonymous function that takes a list of parameters, joins them, and prints them. &amp;nbsp;Next we curried that list with 3 fruit. &amp;nbsp;To do this we created a new anonymous subroutine that passed in the three fruit into the first anonymous subroutine. &amp;nbsp;After that we repeated the process, by currying the new subroutine we created from the last curried we now have a subroutine that calls the subroutine created on line 3 with 2 new fruit, that subroutine calls the subroutine created on line 1. &amp;nbsp;Once we execute this we will output a list of all the fruit we've given to the function.&lt;/p&gt;
&lt;p&gt;We don't have to only curry anonymous functions. &amp;nbsp;Because we can get the reference of named functions and builtins we can also curry those.&lt;/p&gt;
&lt;p&gt;
&lt;script src="http://gist.github.com/556984.js?file=fpblog-week3c.pl"&gt;&lt;/script&gt;
&lt;/p&gt;
&lt;p&gt;This concludes this week's lesson. &amp;nbsp;Next week we will move past the building blocks of functional programming and start getting into systems built on top of this functional foundation. &amp;nbsp;Next week we'll cover dynamic dispatch tables.&lt;/p&gt;
&lt;p&gt;As an aside, the name curry didn't come from the tasty South Asian type of dish, unlike the &lt;a href="http://listserv.linguistlist.org/cgi-bin/wa?A2=ind0208a&amp;amp;L=ads-l&amp;amp;P=11751"&gt;naming of Mix-Ins&lt;/a&gt;. &amp;nbsp;Instead, currying is named after the American Mathematician and Logician &lt;a href="http://en.wikipedia.org/wiki/Haskell_Curry"&gt;Haskell Curry&lt;/a&gt;.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/week-3-currying"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/week-3-currying#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=uMNRjnzeBIA:8B89OhYQcUg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=uMNRjnzeBIA:8B89OhYQcUg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=uMNRjnzeBIA:8B89OhYQcUg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=uMNRjnzeBIA:8B89OhYQcUg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/uMNRjnzeBIA" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/week-3-currying</feedburner:origLink></item>
    <item>
      <pubDate>Tue, 14 Sep 2010 21:08:00 -0700</pubDate>
      <title>Cutting Back</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/SX64KYgTZn8/cutting-back</link>
      <guid isPermaLink="false">http://mfollett.com/cutting-back</guid>
      <description>&lt;p&gt;
	&lt;p&gt;I will probably be cutting back to one larger article a week. &amp;nbsp;The articles will probably either focus on Perl 6 or functional programming, I doubt I will continue the Moose series during this time. &amp;nbsp;Moose is great, but the documentation is so approachable I doubt I can really add much to it, at least not until I read &lt;a href="http://www.amazon.com/gp/product/0262610744?ie=UTF8&amp;amp;tag=mfollettcom-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0262610744"&gt;The Art of the Metaobject Protocol&lt;/a&gt;&lt;img src="http://www.assoc-amazon.com/e/ir?t=mfollettcom-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0262610744" border="0" height="1" alt="" style="border: none !important; margin: 0px !important;" width="1" /&gt; .&lt;/p&gt;
&lt;p&gt;It is awfully early to be doing so but I'm doubling my course load for my masters, while holding a full time job, fixing up my house, and preparing &lt;a href="http://strangeloop2010.com/talks/14492"&gt;my talk&lt;/a&gt; at &lt;a href="http://strangeloop2010.com/"&gt;Strange Loop 2010&lt;/a&gt;. &amp;nbsp;Sorry for anyone who enjoyed the current frequency.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/cutting-back"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/cutting-back#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=SX64KYgTZn8:uqAm2yM45t0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=SX64KYgTZn8:uqAm2yM45t0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=SX64KYgTZn8:uqAm2yM45t0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=SX64KYgTZn8:uqAm2yM45t0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/SX64KYgTZn8" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/cutting-back</feedburner:origLink></item>
    <item>
      <pubDate>Sun, 12 Sep 2010 18:49:00 -0700</pubDate>
      <title>Week 3: Lazy Evaluation</title>
      <link>http://feedproxy.google.com/~r/TooMuchMeta/~3/k8x7bUTU-U8/week-3-lazy-evaluation</link>
      <guid isPermaLink="false">http://mfollett.com/week-3-lazy-evaluation</guid>
      <description>&lt;p&gt;
	&lt;p&gt;One of the popular concepts in functional programming is the concept of &lt;em&gt;lazy evaluation&lt;/em&gt;. &amp;nbsp;For code to be lazily evaluated it means that instead of being evaluated at the point when the system reaches it it is instead evaluated at the point that the results are needed. &amp;nbsp;The concept of lazy evaluation exists in lots of languages; Perl 6 uses them for lists, as does Python, and languages like Haskell, Clojure, and others use them quite frequently. &amp;nbsp;In fact, at the latest &lt;a href="http://clojurecljub.wordpress.com/"&gt;Clojure Cljub&lt;/a&gt; meeting one developer was complaining that Clojure was so lazy it was hard for him to tell when it was doing nothing at all.&lt;/p&gt;
&lt;p&gt;The benefits of having the ability to lazily evaluate code show up in many cases. &amp;nbsp;Lazy evaluation can allow developers to represent "infinite streams" because the only portion of the stream that is computed is the portion that the program needs to perform its task. &amp;nbsp;Without lazy evaluation the program would try and compute all possible values and never complete. &amp;nbsp;Additionally, things like &lt;a href="http://search.cpan.org/~drolsky/Moose-1.12/lib/Moose.pm"&gt;Moose&lt;/a&gt; use this concept to allow a developer to lazily evaluate attribute construction. &amp;nbsp;This is hugely beneficial because it means that attributes that take a long time to construct will only be constructed when they are needed, instead of on the main object's construction. &amp;nbsp;&lt;a href="http://search.cpan.org/~frew/DBIx-Class-0.08123/lib/DBIx/Class.pm"&gt;DBIx::Class&lt;/a&gt; also uses this, the query to the database doesn't happen when 'search' is called on the DBIx::Class object. &amp;nbsp;Instead, it is called when the first piece of data is retrieved. &amp;nbsp;This allows DBIx::Class to wait and collect as much information about what the query really needs to be before it executes it, saving precious database time by not making wasteful queries. &amp;nbsp;A final example would be &lt;a href="http://search.cpan.org/dist/Object-Trampoline/lib/Object/Trampoline.pm"&gt;Object::Trampoline&lt;/a&gt;, which can delay the construction of an object and the loading of modules.&lt;/p&gt;
&lt;p&gt;So, how do we lazily evaluate code in Perl 5? &amp;nbsp;We simply wrap it in a subroutine. &amp;nbsp;Let's say, for example, we wanted to make a stream that generated the set of all natural numbers (&lt;strong&gt;N&lt;/strong&gt;), which is simply all the integers &amp;ge; 0. &amp;nbsp;We would simply write something like this:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-perl"&gt;
    
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;span rel="#L6" id="L6"&gt;6&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
            
              
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$stream&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$previous&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nv"&gt;$stream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;sub &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;$previous&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC6"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
              
            
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Now, each time we want a new natural number we can call the anonymous subroutine and a new one will be generated. &amp;nbsp;We could then use this in a while loop:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-perl"&gt;
    
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
            
              
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nb"&gt;defined&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$val&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$stream&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;say&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;We&amp;#39;ve reached number $val!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
              
            
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Another benefit of this approach is that we can now provide streams of numbers logically separated from the looping method (which is a common benefit of iterators). &amp;nbsp;So, for example, we could use these two streams with the same while loop:&lt;/p&gt;
&lt;p&gt;&lt;div class="data type-perl"&gt;
    
      &lt;table class="lines" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;pre class="line_numbers"&gt;&lt;span rel="#L1" id="L1"&gt;1&lt;/span&gt;
&lt;span rel="#L2" id="L2"&gt;2&lt;/span&gt;
&lt;span rel="#L3" id="L3"&gt;3&lt;/span&gt;
&lt;span rel="#L4" id="L4"&gt;4&lt;/span&gt;
&lt;span rel="#L5" id="L5"&gt;5&lt;/span&gt;
&lt;span rel="#L6" id="L6"&gt;6&lt;/span&gt;
&lt;span rel="#L7" id="L7"&gt;7&lt;/span&gt;
&lt;span rel="#L8" id="L8"&gt;8&lt;/span&gt;
&lt;span rel="#L9" id="L9"&gt;9&lt;/span&gt;
&lt;span rel="#L10" id="L10"&gt;10&lt;/span&gt;
&lt;span rel="#L11" id="L11"&gt;11&lt;/span&gt;
&lt;span rel="#L12" id="L12"&gt;12&lt;/span&gt;
&lt;span rel="#L13" id="L13"&gt;13&lt;/span&gt;
&lt;span rel="#L14" id="L14"&gt;14&lt;/span&gt;
&lt;span rel="#L15" id="L15"&gt;15&lt;/span&gt;
&lt;span rel="#L16" id="L16"&gt;16&lt;/span&gt;
&lt;span rel="#L17" id="L17"&gt;17&lt;/span&gt;
&lt;span rel="#L18" id="L18"&gt;18&lt;/span&gt;
&lt;span rel="#L19" id="L19"&gt;19&lt;/span&gt;
&lt;span rel="#L20" id="L20"&gt;20&lt;/span&gt;
&lt;span rel="#L21" id="L21"&gt;21&lt;/span&gt;
&lt;span rel="#L22" id="L22"&gt;22&lt;/span&gt;
&lt;span rel="#L23" id="L23"&gt;23&lt;/span&gt;
&lt;span rel="#L24" id="L24"&gt;24&lt;/span&gt;
&lt;span rel="#L25" id="L25"&gt;25&lt;/span&gt;
&lt;span rel="#L26" id="L26"&gt;26&lt;/span&gt;
&lt;span rel="#L27" id="L27"&gt;27&lt;/span&gt;
&lt;span rel="#L28" id="L28"&gt;28&lt;/span&gt;
&lt;span rel="#L29" id="L29"&gt;29&lt;/span&gt;
&lt;span rel="#L30" id="L30"&gt;30&lt;/span&gt;
&lt;span rel="#L31" id="L31"&gt;31&lt;/span&gt;
&lt;/pre&gt;
          &lt;/td&gt;
          &lt;td width="100%"&gt;
            
              
                &lt;div class="highlight"&gt;&lt;pre /&gt;&lt;div class="line" id="LC1"&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$stream&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC2"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$previous&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC4"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nv"&gt;$stream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;sub &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;$previous&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC5"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC6"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC7"&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$limited_stream&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC8"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC9"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$previous&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC10"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nv"&gt;$limited_stream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;sub &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$previous&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;$previous&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC11"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC12"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC13"&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$limited_even_stream&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC14"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC15"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$previous&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC16"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="nv"&gt;$limited_even_stream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;sub &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$previous&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nv"&gt;$previous&lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC17"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC18"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC19"&gt;&lt;span class="k"&gt;sub &lt;/span&gt;&lt;span class="nf"&gt;say_numbers_in_stream&lt;/span&gt; &lt;/div&gt;&lt;div class="line" id="LC20"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC21"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$stream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;shift&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC22"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nb"&gt;defined&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;my&lt;/span&gt; &lt;span class="nv"&gt;$val&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$stream&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC23"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="p"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC24"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="n"&gt;say&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;We&amp;#39;ve reached number $val!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC25"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC26"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC27"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC28"&gt;&lt;span class="n"&gt;say_numbers_in_stream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$limited_stream&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC29"&gt;&lt;span class="n"&gt;say_numbers_in_stream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$limited_even_stream&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div class="line" id="LC30"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="line" id="LC31"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;
              
            
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    
  &lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Obviously, we could do considerably more interesting things than this. &amp;nbsp;MJD's &lt;a href="http://hop.perl.plover.com/"&gt;Higher Order Perl&lt;/a&gt; talks about creating lazy linked lists in chapter 6.2.&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://mfollett.com/week-3-lazy-evaluation"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://mfollett.com/week-3-lazy-evaluation#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=k8x7bUTU-U8:qwqZnlrHcg8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=k8x7bUTU-U8:qwqZnlrHcg8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/TooMuchMeta?a=k8x7bUTU-U8:qwqZnlrHcg8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/TooMuchMeta?i=k8x7bUTU-U8:qwqZnlrHcg8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TooMuchMeta/~4/k8x7bUTU-U8" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/713188/Follett_Matt_Profile_Picture.png</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/4xlrZyYErAGZ</posterous:profileUrl>
        <posterous:firstName>Matt</posterous:firstName>
        <posterous:lastName>Follett</posterous:lastName>
        <posterous:nickName>mfollett</posterous:nickName>
        <posterous:displayName>Matt Follett</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://mfollett.com/week-3-lazy-evaluation</feedburner:origLink></item>
  </channel>
</rss>

