<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Commenti per Franco Lombardo</title>
	<link>http://www.francolombardo.net</link>
	<description>Linguaggio Scala, Java, AS400 e...cose piÃ¹ serie</description>
	<pubDate>Fri, 10 Sep 2010 20:27:44 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>Commenti su Fantom vs Scala: semicolon inference and something more di Carlos</title>
		<link>http://www.francolombardo.net/fantom-vs-scala-semicolon-inference-and-something-more_post-98.html#comment-9432</link>
		<dc:creator>Carlos</dc:creator>
		<pubDate>Fri, 16 Jul 2010 10:13:39 +0000</pubDate>
		<guid>http://www.francolombardo.net/fantom-vs-scala-semicolon-inference-and-something-more_post-98.html#comment-9432</guid>
		<description>Hey there!
Good comparison on both langs. I'm trying to do a comparison between JVM and CLR languages. 19 languages I'm including on that comparison including Scala and Fantom. You can have a look on my blog: http://carlosqt.blogspot.com/

The comparison goes like this: you have the same program (OO Hello World) implemented in 19 languages using exactly the same features and rules) and then compare them based on some metrics. The comparisons so far are between Keywords and Lines of code :) 

Fantom:
http://carlosqt.blogspot.com/2010/07/oo-hello-world-fantom.html
Scala:
http://carlosqt.blogspot.com/2010/07/oo-hello-world-scala.html

Then you have:
http://carlosqt.blogspot.com/2010/07/how-many-keywords-do-you-type-in-your.html
and
http://carlosqt.blogspot.com/2010/07/how-many-lines-to-code-same.html</description>
		<content:encoded><![CDATA[<p>Hey there!<br />
Good comparison on both langs. I&#8217;m trying to do a comparison between JVM and CLR languages. 19 languages I&#8217;m including on that comparison including Scala and Fantom. You can have a look on my blog: <a href="http://carlosqt.blogspot.com/" rel="nofollow">http://carlosqt.blogspot.com/</a></p>
<p>The comparison goes like this: you have the same program (OO Hello World) implemented in 19 languages using exactly the same features and rules) and then compare them based on some metrics. The comparisons so far are between Keywords and Lines of code <img src='http://www.francolombardo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Fantom:<br />
<a href="http://carlosqt.blogspot.com/2010/07/oo-hello-world-fantom.html" rel="nofollow">http://carlosqt.blogspot.com/2010/07/oo-hello-world-fantom.html</a><br />
Scala:<br />
<a href="http://carlosqt.blogspot.com/2010/07/oo-hello-world-scala.html" rel="nofollow">http://carlosqt.blogspot.com/2010/07/oo-hello-world-scala.html</a></p>
<p>Then you have:<br />
<a href="http://carlosqt.blogspot.com/2010/07/how-many-keywords-do-you-type-in-your.html" rel="nofollow">http://carlosqt.blogspot.com/2010/07/how-many-keywords-do-you-type-in-your.html</a><br />
and<br />
<a href="http://carlosqt.blogspot.com/2010/07/how-many-lines-to-code-same.html" rel="nofollow">http://carlosqt.blogspot.com/2010/07/how-many-lines-to-code-same.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Bowling game Kata in Erlang reloaded di Franco Lombardo</title>
		<link>http://www.francolombardo.net/bowling-game-kata-in-erlang-reloaded_post-105.html#comment-9384</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Thu, 01 Jul 2010 04:52:16 +0000</pubDate>
		<guid>http://www.francolombardo.net/bowling-game-kata-in-erlang-reloaded_post-105.html#comment-9384</guid>
		<description>Here is a comment from Matteo Vaccari:

Hi Franco! Two things:

- a tail-recursive solution is just like a while loop in a different syntax

- you can gain a lot of readability in functional languages if you think of composing functions like building blocks.

Have fun!

&lt;hr&gt;
And here is my answer:

Matteo,

I forgot to mention that I chose not to use a tail-recursive solution in order to improve readability, since the problem involves a small amounts of recursive calls.

Iâ€™ll try to improve my functional programming skills using your advice: thanks!</description>
		<content:encoded><![CDATA[<p>Here is a comment from Matteo Vaccari:</p>
<p>Hi Franco! Two things:</p>
<p>- a tail-recursive solution is just like a while loop in a different syntax</p>
<p>- you can gain a lot of readability in functional languages if you think of composing functions like building blocks.</p>
<p>Have fun!</p>
<hr />
And here is my answer:</p>
<p>Matteo,</p>
<p>I forgot to mention that I chose not to use a tail-recursive solution in order to improve readability, since the problem involves a small amounts of recursive calls.</p>
<p>Iâ€™ll try to improve my functional programming skills using your advice: thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Bowling game Kata in Erlang di Franco Lombardo</title>
		<link>http://www.francolombardo.net/bowling-game-kata-in-erlang_post-104.html#comment-9377</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Tue, 25 May 2010 07:46:04 +0000</pubDate>
		<guid>http://www.francolombardo.net/bowling-game-kata-in-erlang_post-104.html#comment-9377</guid>
		<description>Ouch! Reading this &lt;a href="http://bit.ly/aMouV3" rel="nofollow"&gt;good post from Ron Jeffries&lt;/a&gt; I discovered a test that does not pass with my solution (but which passes with Gabriele's one):
&lt;code&gt;
pitStrikeNinthFrame_test() -&gt;
  Game = listOf(0, 16) ++ [10, 2, 3],
  ?assertEqual(20, bowling:score(Game)).
&lt;/code&gt;
I need some time to think about it! Stay tuned ;-)</description>
		<content:encoded><![CDATA[<p>Ouch! Reading this <a href="http://bit.ly/aMouV3" rel="nofollow">good post from Ron Jeffries</a> I discovered a test that does not pass with my solution (but which passes with Gabriele&#8217;s one):<br />
<code><br />
pitStrikeNinthFrame_test() -><br />
  Game = listOf(0, 16) ++ [10, 2, 3],<br />
  ?assertEqual(20, bowling:score(Game)).<br />
</code><br />
I need some time to think about it! Stay tuned <img src='http://www.francolombardo.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Quanta RAM è installata su un AS400 - System i di Franco Lombardo</title>
		<link>http://www.francolombardo.net/quanta-ram-e-installata-su-un-as400-system-i_post-40.html#comment-9333</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Fri, 07 May 2010 08:06:30 +0000</pubDate>
		<guid>http://www.francolombardo.net/quanta-ram-e-installata-su-un-as400-system-i_post-40.html#comment-9333</guid>
		<description>Non conosco un modo per capire la quantità di RAM utilizzata dal sistema, probabilmente perché questo concetto non si applica bene ad AS400, che in realtà la utilizza &lt;i&gt;tutta&lt;/i&gt;. 
Con il comando &lt;code&gt;WRKSYSSTS ASTLVL(*INTERMED)&lt;/code&gt; puoi capire comunque se è necessario procedere all'acquisto di nuova memoria. Se nelle colonne Err. DB/Non DB compaiono sempre (usa ovviamente F5 per aggionare) numeri grandi, allora è sicuramente consigliabile aumentare la quantità di memoria.</description>
		<content:encoded><![CDATA[<p>Non conosco un modo per capire la quantità di RAM utilizzata dal sistema, probabilmente perché questo concetto non si applica bene ad AS400, che in realtà la utilizza <i>tutta</i>.<br />
Con il comando <code>WRKSYSSTS ASTLVL(*INTERMED)</code> puoi capire comunque se è necessario procedere all&#8217;acquisto di nuova memoria. Se nelle colonne Err. DB/Non DB compaiono sempre (usa ovviamente F5 per aggionare) numeri grandi, allora è sicuramente consigliabile aumentare la quantità di memoria.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Quanta RAM è installata su un AS400 - System i di Claudio Verniani</title>
		<link>http://www.francolombardo.net/quanta-ram-e-installata-su-un-as400-system-i_post-40.html#comment-9329</link>
		<dc:creator>Claudio Verniani</dc:creator>
		<pubDate>Thu, 06 May 2010 21:07:39 +0000</pubDate>
		<guid>http://www.francolombardo.net/quanta-ram-e-installata-su-un-as400-system-i_post-40.html#comment-9329</guid>
		<description>Grazie. Ma come sapere se questa ram la uso oppure no? Senza chiamare gli esperti..
Questo mi servirebbe per capire se la devo compare ancora...

Claudio</description>
		<content:encoded><![CDATA[<p>Grazie. Ma come sapere se questa ram la uso oppure no? Senza chiamare gli esperti..<br />
Questo mi servirebbe per capire se la devo compare ancora&#8230;</p>
<p>Claudio</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su I don&#8217;t like infixes di Franco Lombardo</title>
		<link>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9225</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Mon, 12 Apr 2010 19:54:59 +0000</pubDate>
		<guid>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9225</guid>
		<description>@fogus
You said &lt;cite&gt;"what happens if you need to compare more than just Ints? What if you need to mix them?"&lt;/cite&gt;
Well, here is an example:
&lt;pre lang="scala"&gt;
package net.fl.clojure

object ClojureDemoGeneric {
  case class RichList[A] (list : List[A]) {
    def isOrderedBy(f: (A, A) =&gt; Boolean) : Boolean = list match {
      case Nil =&gt; true
      case x :: Nil =&gt; true
      case x :: y :: xs =&gt; f(x, y) &#038;&#038; new RichList[A](y :: xs).isOrderedBy(f)
    }
  }
 
  implicit def listConverter[A] (list: List[A]) = new RichList[A](list)  
 
  def main(args : Array[String]) : Unit = {
    //lexicographic ordering: prints true
    println(List("a", "c", "z").isOrderedBy(_ &lt; _))
    
    //natural nubers ordering: prints false
    println(List(1, 20, 4) isOrderedBy (_ &lt; _))
 
    //floating point ordering: prints true
    println((1.0 :: 2.5 :: 3.9 :: Nil).isOrderedBy(_ &lt; _))
    
    //custom ordering: prints false
    println(List("one", 2, 3.0) isOrderedBy ((x, y) =&gt; x.toString() &lt; y .toString()))
  }
}
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@fogus<br />
You said <cite>&#8220;what happens if you need to compare more than just Ints? What if you need to mix them?&#8221;</cite><br />
Well, here is an example:</p>
<pre lang="scala">
package net.fl.clojure

object ClojureDemoGeneric {
  case class RichList[A] (list : List[A]) {
    def isOrderedBy(f: (A, A) => Boolean) : Boolean = list match {
      case Nil => true
      case x :: Nil => true
      case x :: y :: xs => f(x, y) &#038;&#038; new RichList[A](y :: xs).isOrderedBy(f)
    }
  }

  implicit def listConverter[A] (list: List[A]) = new RichList[A](list)  

  def main(args : Array[String]) : Unit = {
    //lexicographic ordering: prints true
    println(List("a", "c", "z").isOrderedBy(_ < _))

    //natural nubers ordering: prints false
    println(List(1, 20, 4) isOrderedBy (_ < _))

    //floating point ordering: prints true
    println((1.0 :: 2.5 :: 3.9 :: Nil).isOrderedBy(_ < _))

    //custom ordering: prints false
    println(List("one", 2, 3.0) isOrderedBy ((x, y) => x.toString() < y .toString()))
  }
}
</pre>
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su I don&#8217;t like infixes di Franco Lombardo</title>
		<link>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9224</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Mon, 12 Apr 2010 15:37:40 +0000</pubDate>
		<guid>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9224</guid>
		<description>Here I use the term "Literate Programming" not in the strict Knut's sense, but in the meaning, that is now widespread, of a style of programming that mimics natural languages. See, for example, &lt;a href="http://weblogs.java.net/blog/tomwhite/archive/2006/05/literate_progra_1.html" rel="nofollow"&gt;this post on java.net&lt;/a&gt;. (But you can find a similar usage in many articles on Behaviour Driven Development).
Anyway, even if my opinion is that the maximum of code expressivity is gained by mixing infix and prefix notations, as I told before, you can have a purely infix Scala code using &lt;code&gt;(1 :: 2 :: 3 :: Nil) isOrderedBy (_ &lt; _)&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Here I use the term &#8220;Literate Programming&#8221; not in the strict Knut&#8217;s sense, but in the meaning, that is now widespread, of a style of programming that mimics natural languages. See, for example, <a href="http://weblogs.java.net/blog/tomwhite/archive/2006/05/literate_progra_1.html" rel="nofollow">this post on java.net</a>. (But you can find a similar usage in many articles on Behaviour Driven Development).<br />
Anyway, even if my opinion is that the maximum of code expressivity is gained by mixing infix and prefix notations, as I told before, you can have a purely infix Scala code using <code>(1 :: 2 :: 3 :: Nil) isOrderedBy (_ < _)</code></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su I don&#8217;t like infixes di nibble</title>
		<link>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9223</link>
		<dc:creator>nibble</dc:creator>
		<pubDate>Mon, 12 Apr 2010 13:43:05 +0000</pubDate>
		<guid>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9223</guid>
		<description>my 2 cents:
 * Mixing infix and prefix notation, like you do in your scale example, don\'t seems to me \&#34;more clear\&#34; than a pure infix (C) or prefix (clojure) solution.
 * You talk about Literate Programming, but prefix and infix notation has nothing to do with LP. You are talking about code clarity, and seems to me that here you are saying that infix notation is \&#34;more clear\&#34; because it\'s more widespread... 

regards
nibble</description>
		<content:encoded><![CDATA[<p>my 2 cents:<br />
 * Mixing infix and prefix notation, like you do in your scale example, don\&#8217;t seems to me \&quot;more clear\&quot; than a pure infix (C) or prefix (clojure) solution.<br />
 * You talk about Literate Programming, but prefix and infix notation has nothing to do with LP. You are talking about code clarity, and seems to me that here you are saying that infix notation is \&quot;more clear\&quot; because it\&#8217;s more widespread&#8230; </p>
<p>regards<br />
nibble</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su I don&#8217;t like infixes di Franco Lombardo</title>
		<link>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9220</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Mon, 12 Apr 2010 12:23:23 +0000</pubDate>
		<guid>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9220</guid>
		<description>@jneira
You say &lt;cite&gt;"more sintactic sugar, more prone to errors and less elegance"&lt;/cite&gt;.
I agree about syntactic sugar, while about the point of "error proness" I think it's in someway true, even if, on the other hand, you must consider how many errors you'll do in a language that's not "clear".
About elegance, well, you already said...</description>
		<content:encoded><![CDATA[<p>@jneira<br />
You say <cite>&#8220;more sintactic sugar, more prone to errors and less elegance&#8221;</cite>.<br />
I agree about syntactic sugar, while about the point of &#8220;error proness&#8221; I think it&#8217;s in someway true, even if, on the other hand, you must consider how many errors you&#8217;ll do in a language that&#8217;s not &#8220;clear&#8221;.<br />
About elegance, well, you already said&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su I don&#8217;t like infixes di Franco Lombardo</title>
		<link>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9219</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Mon, 12 Apr 2010 12:16:17 +0000</pubDate>
		<guid>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9219</guid>
		<description>@fogus

My point is that, with a flexible language like Scala, you can have many solutions: you can use the prefix notation, or the infix one if you feel it better. In other languages you have only one choice, which, I think, most of the times is far less readable.</description>
		<content:encoded><![CDATA[<p>@fogus</p>
<p>My point is that, with a flexible language like Scala, you can have many solutions: you can use the prefix notation, or the infix one if you feel it better. In other languages you have only one choice, which, I think, most of the times is far less readable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su I don&#8217;t like infixes di fogus</title>
		<link>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9218</link>
		<dc:creator>fogus</dc:creator>
		<pubDate>Mon, 12 Apr 2010 11:40:29 +0000</pubDate>
		<guid>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9218</guid>
		<description>You've slightly changed the original problem at hand and I'm a little confused about your insistence on the "infix notation of Clojure", but I'll bite.

The original premise was built on finding the monotonically increasing order of a number of arguments, which in Scala could be written as a function isminc:

def isminc(a:Int, b:Int, c:Int, d:Int, e:Int):Boolean = a &#60; b &#38;&#38; b &#60; c &#38;&#38; c &#60; d &#38;&#38; d &#60; e
isminc(1,2,3,4,5)
res6: Boolean = true

That's Scala, not C.  You know the Clojure solution, so there is no need to cover that ground, but let's put it into a function:

(defn minc? [a b c d e] (&#60; a b c d e))
(minc? 1 2 3 4 5)
true

This is the original premise, and I would contest that the Clojure example is far more readable.  However, by changing the problem in the way you did, you've actually helped to prove my original point.  That is, you've taken a problem solved by a somewhat verbose infix solution, put it into a list and made it into a more flexible method call *prefix* solution.  Your way (or some variant thereof... I would have probably used a Trait instead, but I realize that you want to keep things as compact as possible) was probably the correct way to solve this particular problem.  But what happens if you need to compare more than just Ints?  What if you need to mix them?  BTW: I like Scala and I use it every day, so don't take this as a slam against it.  Instead, people like to pick and choose straw-man arguments against prefix notation without thinking through the vast number of cases where it makes sense.  Even if your code was littered with a vast number of 1 + 2 then it's debatable that using (+ 1 2) instead makes things harder to read.</description>
		<content:encoded><![CDATA[<p>You&#8217;ve slightly changed the original problem at hand and I&#8217;m a little confused about your insistence on the &#8220;infix notation of Clojure&#8221;, but I&#8217;ll bite.</p>
<p>The original premise was built on finding the monotonically increasing order of a number of arguments, which in Scala could be written as a function isminc:</p>
<p>def isminc(a:Int, b:Int, c:Int, d:Int, e:Int):Boolean = a &lt; b &amp;&amp; b &lt; c &amp;&amp; c &lt; d &amp;&amp; d &lt; e<br />
isminc(1,2,3,4,5)<br />
res6: Boolean = true</p>
<p>That&#8217;s Scala, not C.  You know the Clojure solution, so there is no need to cover that ground, but let&#8217;s put it into a function:</p>
<p>(defn minc? [a b c d e] (&lt; a b c d e))<br />
(minc? 1 2 3 4 5)<br />
true</p>
<p>This is the original premise, and I would contest that the Clojure example is far more readable.  However, by changing the problem in the way you did, you&#8217;ve actually helped to prove my original point.  That is, you&#8217;ve taken a problem solved by a somewhat verbose infix solution, put it into a list and made it into a more flexible method call *prefix* solution.  Your way (or some variant thereof&#8230; I would have probably used a Trait instead, but I realize that you want to keep things as compact as possible) was probably the correct way to solve this particular problem.  But what happens if you need to compare more than just Ints?  What if you need to mix them?  BTW: I like Scala and I use it every day, so don&#8217;t take this as a slam against it.  Instead, people like to pick and choose straw-man arguments against prefix notation without thinking through the vast number of cases where it makes sense.  Even if your code was littered with a vast number of 1 + 2 then it&#8217;s debatable that using (+ 1 2) instead makes things harder to read.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su I don&#8217;t like infixes di jneira</title>
		<link>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9216</link>
		<dc:creator>jneira</dc:creator>
		<pubDate>Mon, 12 Apr 2010 08:14:17 +0000</pubDate>
		<guid>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9216</guid>
		<description>Yum, i didnt know that the great influence of haskell on scala also applied to building lists.
In scala,haskell (or c++ with operator overloading) you can choose or mix the notations you are more familiar (literally is familiar IMO) to build dsls close to english but it has a price: more sintactic sugar, more prone to errors and less elegance. But "elegance" is still more subjective than "naturalness" :-P</description>
		<content:encoded><![CDATA[<p>Yum, i didnt know that the great influence of haskell on scala also applied to building lists.<br />
In scala,haskell (or c++ with operator overloading) you can choose or mix the notations you are more familiar (literally is familiar IMO) to build dsls close to english but it has a price: more sintactic sugar, more prone to errors and less elegance. But &#8220;elegance&#8221; is still more subjective than &#8220;naturalness&#8221; <img src='http://www.francolombardo.net/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su I don&#8217;t like infixes di Franco Lombardo</title>
		<link>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9215</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Mon, 12 Apr 2010 07:27:36 +0000</pubDate>
		<guid>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9215</guid>
		<description>I agree with you : learning to switch from infix and prefix notation could really 
expand and improve your mind. Anyway, at least in the european modern languages I know, the infix notation is preminent. So, if we want to go in the direction of literate programming, we should choose programming languages that can use it. Moreover, as you said, Scala, as natural languages, has a mixed notation, while Lisp-like ones are more rigid in the direction of infix notation.
By the way, in Scala you could write &lt;code&gt;println( (1 :: 2 :: 3 :: Nil).isOrderedBy(_ &lt; _))&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I agree with you : learning to switch from infix and prefix notation could really<br />
expand and improve your mind. Anyway, at least in the european modern languages I know, the infix notation is preminent. So, if we want to go in the direction of literate programming, we should choose programming languages that can use it. Moreover, as you said, Scala, as natural languages, has a mixed notation, while Lisp-like ones are more rigid in the direction of infix notation.<br />
By the way, in Scala you could write <code>println( (1 :: 2 :: 3 :: Nil).isOrderedBy(_ < _))</code></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su I don&#8217;t like infixes di jneira</title>
		<link>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9214</link>
		<dc:creator>jneira</dc:creator>
		<pubDate>Mon, 12 Apr 2010 06:14:15 +0000</pubDate>
		<guid>http://www.francolombardo.net/i-dont-like-infixes_post-103.html#comment-9214</guid>
		<description>Mmm i think the only sin of prefix (or fortran postfix)  notation is being less popular than infix one. There isnt a only "natural" way of lang syntax, neither real langs nor prog langs. I think learn to switch from one to another expand and improve your mind.
F. e. x=x+1 is very common in imperative prog and its completely different in "natural" math and in a imperative lang.
Your scala example have prefix and postfix notation, cause "List" is in first place and "isOrderedBy" is in last one and its very much verbose than in clojure and c.
In haskell make a list have a real infix notation a:b:c:d:e:f:g:[]. isnt it strange? ;-)</description>
		<content:encoded><![CDATA[<p>Mmm i think the only sin of prefix (or fortran postfix)  notation is being less popular than infix one. There isnt a only &#8220;natural&#8221; way of lang syntax, neither real langs nor prog langs. I think learn to switch from one to another expand and improve your mind.<br />
F. e. x=x+1 is very common in imperative prog and its completely different in &#8220;natural&#8221; math and in a imperative lang.<br />
Your scala example have prefix and postfix notation, cause &#8220;List&#8221; is in first place and &#8220;isOrderedBy&#8221; is in last one and its very much verbose than in clojure and c.<br />
In haskell make a list have a real infix notation a:b:c:d:e:f:g:[]. isnt it strange? <img src='http://www.francolombardo.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Fantom vs Scala: semicolon inference and something more di Franco Lombardo</title>
		<link>http://www.francolombardo.net/fantom-vs-scala-semicolon-inference-and-something-more_post-98.html#comment-8146</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Tue, 05 Jan 2010 22:55:30 +0000</pubDate>
		<guid>http://www.francolombardo.net/fantom-vs-scala-semicolon-inference-and-something-more_post-98.html#comment-8146</guid>
		<description>Klaus,

another great comment! 
You say "expectations for some reason go higher when it starts looking like a real programming language construct, which perhaps is unreasonable." 
You're right, but I think also that if you give more power you need more safety too. Scala is like a Ferrari race car: as it can run so much, I expect it has good brakes too!!!</description>
		<content:encoded><![CDATA[<p>Klaus,</p>
<p>another great comment!<br />
You say &#8220;expectations for some reason go higher when it starts looking like a real programming language construct, which perhaps is unreasonable.&#8221;<br />
You&#8217;re right, but I think also that if you give more power you need more safety too. Scala is like a Ferrari race car: as it can run so much, I expect it has good brakes too!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Fantom vs Scala: semicolon inference and something more di Klaus</title>
		<link>http://www.francolombardo.net/fantom-vs-scala-semicolon-inference-and-something-more_post-98.html#comment-8051</link>
		<dc:creator>Klaus</dc:creator>
		<pubDate>Mon, 04 Jan 2010 23:55:44 +0000</pubDate>
		<guid>http://www.francolombardo.net/fantom-vs-scala-semicolon-inference-and-something-more_post-98.html#comment-8051</guid>
		<description>Yes, the period helps in the sense that:

&lt;code&gt;
  .unless &#124;-&#62;Bool&#124; {i == 0} 
&lt;/code&gt;

can occur on a line for itself. This is also the case in Scala if one uses the dot notation. 

Below is the example in Scala with several uses, so one can see the different scenarios.

First the definition of the loop construct:

&lt;pre lang="scala"&gt;
object Loop {
  def loop(stmt : =&#62; Unit) : Unless = {
    new Unless(stmt)
  }

  protected class Unless(stmt : =&#62; Unit) {
    def unless(cond : =&#62; Boolean) {
      stmt
      if(!cond)unless(cond)
    }
  }
}

import Loop._
&lt;/pre&gt;

Then the calls:

&lt;pre lang= "scala"&gt;
// call 1 (using mixfix notation - works):                                                                                        

var i : Int = 10;
loop {
  println(i)
  i = i - 1
} unless (i == 0)

// call 2 (also using mixfix notation, but with unless on a line for itself - gives a compile time error):                                                                           

i = 10;
loop {
  println(i)
  i = i - 1
}
unless (i == 0) // occurs on a line for itself - does not work

// Also, if this last line is left out, no error message is given.
// This is how other OO languages work. Not a problem as such in OO languages,
// but it does reduce the value of this mixfix notation for writing DSLs. It makes a DSL unsafe to use.

//  call 3 (using dot notation - works as expected):                                                                                          

i = 10;
loop {
  println(i)
  i = i - 1
}.unless(i == 0)

// call 4 (using dot notation, with unless on a line for itself - works):                                                                                           

i = 10;
loop {
  println(i)
  i = i - 1
}.
unless(i == 0) // occurs on a line for itself     
&lt;/pre&gt;

Scala offers this mixfix notation for defining DSLs, and it looks very appealing. However, one can 
provide only a partial instantiation of a DSL construct and the Scala compiler will be happy. We normally accept this in the case of dot-notation (that's how it is in Java and Python) but our expectations for some reason go higher when it starts looking like a real programming language construct, which perhaps is unreasonable.
Something to think about. Could one think of imposing "static liveness" constraints? Like: 'this intermediate object shouldnever be the result of a statement'.

Note that this problem can be avoided if instead we define the loop-unless construct as a curried function:

&lt;pre lang="scala"&gt;
def loop_unless(stmt : =&#62; Unit)(cond : =&#62; Boolean) {
  stmt
  if(!cond)loop_unless(stmt)(cond)
}
&lt;/pre&gt;

Then one can write:                                                                                                                 

&lt;pre lang="scala"&gt;
i = 20;
loop_unless {
  println(i)
  i = i - 1
} (i == 0)
&lt;/pre&gt;

However, if we write:

&lt;pre lang="scala"&gt;
i = 20;
loop_unless {
  println(i)
  i = i - 1
} 
&lt;/pre&gt;

leaving out the second parameter, the compiler will complain. This approach currently seems the safest way to
define DSLs in Scala.</description>
		<content:encoded><![CDATA[<p>Yes, the period helps in the sense that:</p>
<p><code><br />
  .unless |-&gt;Bool| {i == 0}<br />
</code></p>
<p>can occur on a line for itself. This is also the case in Scala if one uses the dot notation. </p>
<p>Below is the example in Scala with several uses, so one can see the different scenarios.</p>
<p>First the definition of the loop construct:</p>
<pre lang="scala">
object Loop {
  def loop(stmt : =&gt; Unit) : Unless = {
    new Unless(stmt)
  }

  protected class Unless(stmt : =&gt; Unit) {
    def unless(cond : =&gt; Boolean) {
      stmt
      if(!cond)unless(cond)
    }
  }
}

import Loop._
</pre>
<p>Then the calls:</p>
<pre lang= "scala">
// call 1 (using mixfix notation - works):                                                                                        

var i : Int = 10;
loop {
  println(i)
  i = i - 1
} unless (i == 0)

// call 2 (also using mixfix notation, but with unless on a line for itself - gives a compile time error):                                                                           

i = 10;
loop {
  println(i)
  i = i - 1
}
unless (i == 0) // occurs on a line for itself - does not work

// Also, if this last line is left out, no error message is given.
// This is how other OO languages work. Not a problem as such in OO languages,
// but it does reduce the value of this mixfix notation for writing DSLs. It makes a DSL unsafe to use.

//  call 3 (using dot notation - works as expected):                                                                                          

i = 10;
loop {
  println(i)
  i = i - 1
}.unless(i == 0)

// call 4 (using dot notation, with unless on a line for itself - works):                                                                                           

i = 10;
loop {
  println(i)
  i = i - 1
}.
unless(i == 0) // occurs on a line for itself
</pre>
<p>Scala offers this mixfix notation for defining DSLs, and it looks very appealing. However, one can<br />
provide only a partial instantiation of a DSL construct and the Scala compiler will be happy. We normally accept this in the case of dot-notation (that&#8217;s how it is in Java and Python) but our expectations for some reason go higher when it starts looking like a real programming language construct, which perhaps is unreasonable.<br />
Something to think about. Could one think of imposing &#8220;static liveness&#8221; constraints? Like: &#8216;this intermediate object shouldnever be the result of a statement&#8217;.</p>
<p>Note that this problem can be avoided if instead we define the loop-unless construct as a curried function:</p>
<pre lang="scala">
def loop_unless(stmt : =&gt; Unit)(cond : =&gt; Boolean) {
  stmt
  if(!cond)loop_unless(stmt)(cond)
}
</pre>
<p>Then one can write:                                                                                                                 </p>
<pre lang="scala">
i = 20;
loop_unless {
  println(i)
  i = i - 1
} (i == 0)
</pre>
<p>However, if we write:</p>
<pre lang="scala">
i = 20;
loop_unless {
  println(i)
  i = i - 1
}
</pre>
<p>leaving out the second parameter, the compiler will complain. This approach currently seems the safest way to<br />
define DSLs in Scala.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Things I do not like in Scala di Franco Lombardo</title>
		<link>http://www.francolombardo.net/things-i-do-not-like-in-scala_post-69.html#comment-8047</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Mon, 04 Jan 2010 22:07:43 +0000</pubDate>
		<guid>http://www.francolombardo.net/things-i-do-not-like-in-scala_post-69.html#comment-8047</guid>
		<description>Klauss,

thanks for your very good comment, that made me write my latest post: http://www.francolombardo.net/fantom-vs-scala-semicolon-inference-and-something-more_post-98.html</description>
		<content:encoded><![CDATA[<p>Klauss,</p>
<p>thanks for your very good comment, that made me write my latest post: <a href="http://www.francolombardo.net/fantom-vs-scala-semicolon-inference-and-something-more_post-98.html" rel="nofollow">http://www.francolombardo.net/fantom-vs-scala-semicolon-inference-and-something-more_post-98.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Things I do not like in Scala di Klaus</title>
		<link>http://www.francolombardo.net/things-i-do-not-like-in-scala_post-69.html#comment-7939</link>
		<dc:creator>Klaus</dc:creator>
		<pubDate>Thu, 31 Dec 2009 19:08:10 +0000</pubDate>
		<guid>http://www.francolombardo.net/things-i-do-not-like-in-scala_post-69.html#comment-7939</guid>
		<description>Both issues seem somewhat problematic, agree.

Concerning the semicolon inference issue I have specifically seen it come up in the context
of definition of domain specific languages (DSLs). Several Scala features can be used to define
such DSLs, specifically "Automatic Type-Dependent Closure Construction", see :

   http://www.scala-lang.org/node/138

The idea is very! appealing. However, there seems to be three problems
with this approach in Scala, which I would like to see comments on.

 Problem 1 - "the eager semicolon":
 automated inference of semicolon causes DSL constructs to be only
 partially parsed leaving the rest unparsed as a DSL construct

 Problem 2 - "the satisfied semicolon":
 partially written (incomplete) DSL constructs are accepted

 Problem 3 - "the lazy semicolon":
 one has to write a semilon to end a call of a method that takes () as argument,
 otherwise the Scala parser will complain about subsequent text as supurfluous arguments

Let me illustrate the first two problems with (a slight modification
of) the example on the page: http://www.scala-lang.org/node/138.

&lt;pre&gt;
// Suppose we define a loop construct as follows:

object Loop {
 def loop(body: =&#62; Unit): LoopUnlessCond =
  new LoopUnlessCond(body)

 protected class LoopUnlessCond(body: =&#62; Unit) {
  def unless(cond: =&#62; Boolean) {
    body
    if (!cond) unless(cond)
  }
 }
}

// We can now use this as follows (use 1):

import Loop._

var i = 10
loop {
 println("i = " + i)
 i -= 1
} unless (i == 0)

// The above compiles and runs correctly. So far so good.

// Problem 1 : the eager semicolon.
// The following use (use 2) gives a compile time error:

i = 10
loop {
 println("i = " + i)
 i -= 1
}
unless (i == 0)

// This is because the unless method call is on a line for itself.
// Scala will at the '}' infer a semicolon too early. Hence the unless
// will no longer be a call of the method in class LoopUnlessCond.
// This is an example of Problem 1.

// Problem 2 : the satisfied semicolon.
// An example of Problem 2 is the following, which is missing the
// call of unless:

i = 10
loop {
 println("i = " + i)
 i -= 1
}

// this compiles correctly, but does not execute correctly. Nothing is printed.

// Problem 3 : the lazy semicolon.
// Suppose a constructs ends with a keyword, for example 'return' with
no arguments.
// Then one may want to write a class like:

class Return {
 def return() {...}
}
&lt;/pre&gt;

and have a construct like:

&lt;pre&gt;
... return
somethingelse
&lt;/pre&gt;

The compiler will look for an argument to return and will find
'somethingelse' and
will complain that return has too many arguments. So one has to insert
a semicolon to
make it work:

&lt;pre&gt;
... return; // inserted semicolon here
somethingelse
&lt;/pre&gt;

// which is a pitty

Any opinions about these observations?

Regards,

Klaus</description>
		<content:encoded><![CDATA[<p>Both issues seem somewhat problematic, agree.</p>
<p>Concerning the semicolon inference issue I have specifically seen it come up in the context<br />
of definition of domain specific languages (DSLs). Several Scala features can be used to define<br />
such DSLs, specifically &#8220;Automatic Type-Dependent Closure Construction&#8221;, see :</p>
<p>   <a href="http://www.scala-lang.org/node/138" rel="nofollow">http://www.scala-lang.org/node/138</a></p>
<p>The idea is very! appealing. However, there seems to be three problems<br />
with this approach in Scala, which I would like to see comments on.</p>
<p> Problem 1 - &#8220;the eager semicolon&#8221;:<br />
 automated inference of semicolon causes DSL constructs to be only<br />
 partially parsed leaving the rest unparsed as a DSL construct</p>
<p> Problem 2 - &#8220;the satisfied semicolon&#8221;:<br />
 partially written (incomplete) DSL constructs are accepted</p>
<p> Problem 3 - &#8220;the lazy semicolon&#8221;:<br />
 one has to write a semilon to end a call of a method that takes () as argument,<br />
 otherwise the Scala parser will complain about subsequent text as supurfluous arguments</p>
<p>Let me illustrate the first two problems with (a slight modification<br />
of) the example on the page: <a href="http://www.scala-lang.org/node/138." rel="nofollow">http://www.scala-lang.org/node/138.</a></p>
<pre>
// Suppose we define a loop construct as follows:

object Loop {
 def loop(body: =&gt; Unit): LoopUnlessCond =
  new LoopUnlessCond(body)

 protected class LoopUnlessCond(body: =&gt; Unit) {
  def unless(cond: =&gt; Boolean) {
    body
    if (!cond) unless(cond)
  }
 }
}

// We can now use this as follows (use 1):

import Loop._

var i = 10
loop {
 println("i = " + i)
 i -= 1
} unless (i == 0)

// The above compiles and runs correctly. So far so good.

// Problem 1 : the eager semicolon.
// The following use (use 2) gives a compile time error:

i = 10
loop {
 println("i = " + i)
 i -= 1
}
unless (i == 0)

// This is because the unless method call is on a line for itself.
// Scala will at the '}' infer a semicolon too early. Hence the unless
// will no longer be a call of the method in class LoopUnlessCond.
// This is an example of Problem 1.

// Problem 2 : the satisfied semicolon.
// An example of Problem 2 is the following, which is missing the
// call of unless:

i = 10
loop {
 println("i = " + i)
 i -= 1
}

// this compiles correctly, but does not execute correctly. Nothing is printed.

// Problem 3 : the lazy semicolon.
// Suppose a constructs ends with a keyword, for example 'return' with
no arguments.
// Then one may want to write a class like:

class Return {
 def return() {...}
}
</pre>
<p>and have a construct like:</p>
<pre>
... return
somethingelse
</pre>
<p>The compiler will look for an argument to return and will find<br />
&#8217;somethingelse&#8217; and<br />
will complain that return has too many arguments. So one has to insert<br />
a semicolon to<br />
make it work:</p>
<pre>
... return; // inserted semicolon here
somethingelse
</pre>
<p>// which is a pitty</p>
<p>Any opinions about these observations?</p>
<p>Regards,</p>
<p>Klaus</p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Italian Agile Day 2009 - Le mie impressioni di pino</title>
		<link>http://www.francolombardo.net/italian-agile-day-2009-le-mie-impressioni_post-96.html#comment-7580</link>
		<dc:creator>pino</dc:creator>
		<pubDate>Tue, 24 Nov 2009 23:27:52 +0000</pubDate>
		<guid>http://www.francolombardo.net/italian-agile-day-2009-le-mie-impressioni_post-96.html#comment-7580</guid>
		<description>Grazie Franco per questo riassunto...mi fai sembrare di esserci stato ;-)</description>
		<content:encoded><![CDATA[<p>Grazie Franco per questo riassunto&#8230;mi fai sembrare di esserci stato <img src='http://www.francolombardo.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>Commenti su Italian Agile Day 2009 - Le mie impressioni di Franco Lombardo</title>
		<link>http://www.francolombardo.net/italian-agile-day-2009-le-mie-impressioni_post-96.html#comment-7575</link>
		<dc:creator>Franco Lombardo</dc:creator>
		<pubDate>Tue, 24 Nov 2009 08:59:09 +0000</pubDate>
		<guid>http://www.francolombardo.net/italian-agile-day-2009-le-mie-impressioni_post-96.html#comment-7575</guid>
		<description>Per chi volesse maggiori informazioni sulla presentazione di Alberto Quario, &lt;a href="http://www.slideshare.net/realbot/scenario-testing " rel="nofollow"&gt;ecco le slide&lt;/a&gt; e due articoli: &lt;i&gt;&lt;a href="http://www.agilealliance.org/show/910" rel="nofollow"&gt;Object Mother: Easing Test Object Creation in XP&lt;/a&gt;&lt;/i&gt; e &lt;i&gt;&lt;a href="http://nat.truemesh.com/archives/000714.html" rel="nofollow"&gt;Test Data Builders: an alternative to the Object Mother pattern&lt;/a&gt;&lt;/i&gt;

Grazie ad Alberto per la segnalazione.

@Andrea. Sono contento che il post ti sia piacuto. Spero di incontrarti di persona a qualche meeting dell XPUG di Milano.</description>
		<content:encoded><![CDATA[<p>Per chi volesse maggiori informazioni sulla presentazione di Alberto Quario, <a href="http://www.slideshare.net/realbot/scenario-testing " rel="nofollow">ecco le slide</a> e due articoli: <i><a href="http://www.agilealliance.org/show/910" rel="nofollow">Object Mother: Easing Test Object Creation in XP</a></i> e <i><a href="http://nat.truemesh.com/archives/000714.html" rel="nofollow">Test Data Builders: an alternative to the Object Mother pattern</a></i></p>
<p>Grazie ad Alberto per la segnalazione.</p>
<p>@Andrea. Sono contento che il post ti sia piacuto. Spero di incontrarti di persona a qualche meeting dell XPUG di Milano.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
