<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
	>
<channel>
	<title>Comments on: Scala is Not a Functional Programming Language</title>
	<atom:link href="http://enfranchisedmind.com/blog/posts/scala-not-functional/feed/" rel="self" type="application/rss+xml" />
	<link>http://enfranchisedmind.com/blog/posts/scala-not-functional/</link>
	<description>programming, politics, &#38; other religious issues</description>
	<lastBuildDate>Wed, 08 Feb 2012 14:16:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Guest</title>
		<link>http://enfranchisedmind.com/blog/posts/scala-not-functional/#comment-38229</link>
		<dc:creator>Guest</dc:creator>
		<pubDate>Wed, 23 Nov 2011 05:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1304#comment-38229</guid>
		<description>Absolutely!</description>
		<content:encoded><![CDATA[<p>Absolutely!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guest</title>
		<link>http://enfranchisedmind.com/blog/posts/scala-not-functional/#comment-38228</link>
		<dc:creator>Guest</dc:creator>
		<pubDate>Wed, 23 Nov 2011 04:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1304#comment-38228</guid>
		<description>Today we are see many times &quot;OOP failed&quot;. But in the near future we will see the same: &quot;FP failed&quot;. Why? Bcz OOP and FP - both are models of representation of thinking. Nothing else. FP is model from mathematicans, so it&#039;s bad and unpractical - but with very short (and unreadable, so heavy supported) code, only size of FP code is the reason of its popularity. Safe and robust programs (what is need in real industry) looks like Ada, Pascal, D, Eiffel. FP style is &quot;tolerant&quot; to bugs. And falldown of FP popularity is near.

You said about FP in Scala and show examples with currying, matching... But show they as syntax-forms embedded in language (Ocaml). Where you have funcs, you have currying. Benefits of pattern matching are very  controversial. It&#039;s very weak and uncertain attempt to repeat Prolog (even _ is used!). But in Prolog this is the principal other feature: due its bi-direction (absolutely another computation model of Prolog). In FP pattern matching looks naive and inappropriate. And it&#039;s easy to be implemented as equals()/__eq__() overloading and done with &quot;if ... else if...&quot;/&quot;switch...&quot; blocks - more control, more readable and the same number of lines IN ANY language! :)So, Scala has all real FP features instead of syntax tricks of them. What is the OOP? Paradigm or the way of code organization (structuring)? And what is the FP? Paradigm? Or code organization (with syntax sugar, tricks, like matching which is not real matching)?In OOP code organization ideas and paradigm are very confused and close (we want to have state - so record, we want to have functions manipulated this state (and avoid names with structure&#039;s name prefix) - so methods, we want to reuse code - so inheritance. Or this is the paradigm?:) ) Cut TYPES SYSTEM from FP and you&#039;ll get all what you have in any another modern language. Well Scala is FP :) Look, closures are bounded state of args, and programmer doesn&#039;t know where is this state, how to change it... But this is the delegates - state is the class fields, method pointer is the delegate - closure. Where is the border? What model is the better? OOP, IMHO is more readable and controlable (and longer as code lines). You want pure FP? No problems! Write in C/C++ in pure FP mannier! In D you can add &quot;pure&quot; modificator to funcs even! You want lazyness, you have them in Scala, D, Tcl even! So, today, border between OOP and FP is thin. Principally we have 3 paradigms only: declarative (predicate calculation), applicative (Lisp - code is transformable data, code is explicit AST) and imperative (FP, OOP...). And todays many-many language has features of FP, FP languages has OOP features and both are different only for compiler creators. So, is the Scala FP?</description>
		<content:encoded><![CDATA[<p>Today we are see many times &#8220;OOP failed&#8221;. But in the near future we will see the same: &#8220;FP failed&#8221;. Why? Bcz OOP and FP &#8211; both are models of representation of thinking. Nothing else. FP is model from mathematicans, so it&#8217;s bad and unpractical &#8211; but with very short (and unreadable, so heavy supported) code, only size of FP code is the reason of its popularity. Safe and robust programs (what is need in real industry) looks like Ada, Pascal, D, Eiffel. FP style is &#8220;tolerant&#8221; to bugs. And falldown of FP popularity is near.</p>
<p>You said about FP in Scala and show examples with currying, matching&#8230; But show they as syntax-forms embedded in language (Ocaml). Where you have funcs, you have currying. Benefits of pattern matching are very  controversial. It&#8217;s very weak and uncertain attempt to repeat Prolog (even _ is used!). But in Prolog this is the principal other feature: due its bi-direction (absolutely another computation model of Prolog). In FP pattern matching looks naive and inappropriate. And it&#8217;s easy to be implemented as equals()/__eq__() overloading and done with &#8220;if &#8230; else if&#8230;&#8221;/&#8221;switch&#8230;&#8221; blocks &#8211; more control, more readable and the same number of lines IN ANY language! :)So, Scala has all real FP features instead of syntax tricks of them. What is the OOP? Paradigm or the way of code organization (structuring)? And what is the FP? Paradigm? Or code organization (with syntax sugar, tricks, like matching which is not real matching)?In OOP code organization ideas and paradigm are very confused and close (we want to have state &#8211; so record, we want to have functions manipulated this state (and avoid names with structure&#8217;s name prefix) &#8211; so methods, we want to reuse code &#8211; so inheritance. Or this is the paradigm?:) ) Cut TYPES SYSTEM from FP and you&#8217;ll get all what you have in any another modern language. Well Scala is FP :) Look, closures are bounded state of args, and programmer doesn&#8217;t know where is this state, how to change it&#8230; But this is the delegates &#8211; state is the class fields, method pointer is the delegate &#8211; closure. Where is the border? What model is the better? OOP, IMHO is more readable and controlable (and longer as code lines). You want pure FP? No problems! Write in C/C++ in pure FP mannier! In D you can add &#8220;pure&#8221; modificator to funcs even! You want lazyness, you have them in Scala, D, Tcl even! So, today, border between OOP and FP is thin. Principally we have 3 paradigms only: declarative (predicate calculation), applicative (Lisp &#8211; code is transformable data, code is explicit AST) and imperative (FP, OOP&#8230;). And todays many-many language has features of FP, FP languages has OOP features and both are different only for compiler creators. So, is the Scala FP?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://enfranchisedmind.com/blog/posts/scala-not-functional/#comment-38182</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Tue, 26 Jul 2011 21:40:59 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1304#comment-38182</guid>
		<description>He&#039;s right though. &lt;code&gt;def x(a:Int, b:Int) = a + b&lt;/code&gt; defines a method which takes two arguments and returns a product;&lt;b&gt;not&lt;/b&gt; the same thing as &lt;code&gt;let x a b = a + b;;&lt;/code&gt;, which allegedly returns int -&gt; int -&gt; int

The corresponding code in Scala would be &lt;code&gt;def x(a:Int) = (b:Int) =&lt; a + b
def y = x(1)
y(2) // 3&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>He&#8217;s right though. <code>def x(a:Int, b:Int) = a + b</code> defines a method which takes two arguments and returns a product;<b>not</b> the same thing as <code>let x a b = a + b;;</code>, which allegedly returns int -&gt; int -&gt; int</p>
<p>The corresponding code in Scala would be <code>def x(a:Int) = (b:Int) =&lt; a + b<br />
def y = x(1)<br />
y(2) // 3</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://enfranchisedmind.com/blog/posts/scala-not-functional/#comment-38169</link>
		<dc:creator>steve</dc:creator>
		<pubDate>Wed, 01 Jun 2011 15:52:25 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1304#comment-38169</guid>
		<description>@Eric:

Well, I think the problem with the original article was that:

a) The author didn&#039;t really knew Scala and wrote really ugly Scala code (instead of code as clean as his OCaml examples) and based his whole claims on it. He didn&#039;t make any effort to correct his examples.

b) The author thought that &quot;curried-by-default&quot; == &quot;more functional&quot;, although there are exist just as many undisputed functional languages which are not curried-by-default. OCaml, Haskell chose curried-by-default; SML, Scala chose uncurried-by-default, so this is a non-sequitur.

c) The author had the misconception that OO and FP was somehow mutually exclusive. Now, in 2011, it is broadly established that this isn&#039;t the case, Scala was just the first language where the language designer had invested some deeper thoughts on how to do the integration OO-FP integration right. 
No one ever claimed that Scala is less OO because it is also functional; why should it be the other way around?

There might be other valid reasons, like better Java interop, which might make Scala code not as succinct as Haskell code, but sadly this point hasn&#039;t played a role in the following debate.</description>
		<content:encoded><![CDATA[<p>@Eric:</p>
<p>Well, I think the problem with the original article was that:</p>
<p>a) The author didn&#8217;t really knew Scala and wrote really ugly Scala code (instead of code as clean as his OCaml examples) and based his whole claims on it. He didn&#8217;t make any effort to correct his examples.</p>
<p>b) The author thought that &#8220;curried-by-default&#8221; == &#8220;more functional&#8221;, although there are exist just as many undisputed functional languages which are not curried-by-default. OCaml, Haskell chose curried-by-default; SML, Scala chose uncurried-by-default, so this is a non-sequitur.</p>
<p>c) The author had the misconception that OO and FP was somehow mutually exclusive. Now, in 2011, it is broadly established that this isn&#8217;t the case, Scala was just the first language where the language designer had invested some deeper thoughts on how to do the integration OO-FP integration right.<br />
No one ever claimed that Scala is less OO because it is also functional; why should it be the other way around?</p>
<p>There might be other valid reasons, like better Java interop, which might make Scala code not as succinct as Haskell code, but sadly this point hasn&#8217;t played a role in the following debate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://enfranchisedmind.com/blog/posts/scala-not-functional/#comment-38151</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 20 Apr 2011 23:25:10 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=1304#comment-38151</guid>
		<description>Erm...that&#039;s basically what Scala does.
&lt;pre lang=&quot;scala&quot;&gt;
val foo_fun = (a:Int)=&gt;(b:Int)=&gt;a+1
// &gt; foo_fun : Function1[Int, Function1[Int, Int]]
val bar_fun = (a:Int, b:Int)=&gt;a+b
// &gt; bar_fun : Function2[Int, Int, Int]
&lt;/pre&gt;

is roughly equivalent to Haskell&#039;s:
&lt;pre lang=&quot;haskell&quot;&gt;
foo_fun a b = a+b
bar_fun (a,b) = a + b
&lt;/pre&gt;

Also, Scala actually has a very clean currying syntax.

&lt;pre lang=&quot;scala&quot;&gt;
val baz = foo_fun(3, _)
print(baz(2))
val quux = foo_fun(_, 3)
print(quux(4))
&lt;/pre&gt;
&lt;pre lang=&quot;haskell&quot;&gt;
main :: IO ()
main = do
  let baz = foo_fun 3 in print baz 2
  let quux = \a -&gt; foo_fun a 3 -- Scala wins in this case.
    in print quux 4
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Erm&#8230;that&#8217;s basically what Scala does.</p>

<div class="wp_syntax"><div class="code"><pre class="scala" style="font-family:monospace;"><span style="color: #0000ff; font-weight: bold;">val</span> foo<span style="color: #000080;">_</span>fun <span style="color: #000080;">=</span> <span style="color: #F78811;">&#40;</span>a<span style="color: #000080;">:</span>Int<span style="color: #F78811;">&#41;</span><span style="color: #000080;">=&amp;</span>gt<span style="color: #000080;">;</span><span style="color: #F78811;">&#40;</span>b<span style="color: #000080;">:</span>Int<span style="color: #F78811;">&#41;</span><span style="color: #000080;">=&amp;</span>gt<span style="color: #000080;">;</span>a+<span style="color: #F78811;">1</span>
<span style="color: #008000; font-style: italic;">// &amp;gt; foo_fun : Function1[Int, Function1[Int, Int]]</span>
<span style="color: #0000ff; font-weight: bold;">val</span> bar<span style="color: #000080;">_</span>fun <span style="color: #000080;">=</span> <span style="color: #F78811;">&#40;</span>a<span style="color: #000080;">:</span>Int, b<span style="color: #000080;">:</span>Int<span style="color: #F78811;">&#41;</span><span style="color: #000080;">=&amp;</span>gt<span style="color: #000080;">;</span>a+b
<span style="color: #008000; font-style: italic;">// &amp;gt; bar_fun : Function2[Int, Int, Int]</span></pre></div></div>

<p>is roughly equivalent to Haskell&#8217;s:</p>

<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">foo<span style="color: #339933; font-weight: bold;">_</span>fun a b <span style="color: #339933; font-weight: bold;">=</span> a<span style="color: #339933; font-weight: bold;">+</span>b
bar<span style="color: #339933; font-weight: bold;">_</span>fun <span style="color: green;">&#40;</span>a<span style="color: #339933; font-weight: bold;">,</span>b<span style="color: green;">&#41;</span> <span style="color: #339933; font-weight: bold;">=</span> a <span style="color: #339933; font-weight: bold;">+</span> b</pre></div></div>

<p>Also, Scala actually has a very clean currying syntax.</p>

<div class="wp_syntax"><div class="code"><pre class="scala" style="font-family:monospace;"><span style="color: #0000ff; font-weight: bold;">val</span> baz <span style="color: #000080;">=</span> foo<span style="color: #000080;">_</span>fun<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">3</span>, <span style="color: #000080;">_</span><span style="color: #F78811;">&#41;</span>
print<span style="color: #F78811;">&#40;</span>baz<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">2</span><span style="color: #F78811;">&#41;</span><span style="color: #F78811;">&#41;</span>
<span style="color: #0000ff; font-weight: bold;">val</span> quux <span style="color: #000080;">=</span> foo<span style="color: #000080;">_</span>fun<span style="color: #F78811;">&#40;</span><span style="color: #000080;">_</span>, <span style="color: #F78811;">3</span><span style="color: #F78811;">&#41;</span>
print<span style="color: #F78811;">&#40;</span>quux<span style="color: #F78811;">&#40;</span><span style="color: #F78811;">4</span><span style="color: #F78811;">&#41;</span><span style="color: #F78811;">&#41;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="haskell" style="font-family:monospace;">main <span style="color: #339933; font-weight: bold;">::</span> <span style="color: #cccc00; font-weight: bold;">IO</span> <span style="color: green;">&#40;</span><span style="color: green;">&#41;</span>
main <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span>
  <span style="color: #06c; font-weight: bold;">let</span> baz <span style="color: #339933; font-weight: bold;">=</span> foo<span style="color: #339933; font-weight: bold;">_</span>fun <span style="color: red;">3</span> <span style="color: #06c; font-weight: bold;">in</span> <span style="font-weight: bold;">print</span> baz <span style="color: red;">2</span>
  <span style="color: #06c; font-weight: bold;">let</span> quux <span style="color: #339933; font-weight: bold;">=</span> \a <span style="color: #339933; font-weight: bold;">-</span>&amp;gt; foo<span style="color: #339933; font-weight: bold;">_</span>fun a <span style="color: red;">3</span> <span style="color: #5d478b; font-style: italic;">-- Scala wins in this case.</span>
    <span style="color: #06c; font-weight: bold;">in</span> <span style="font-weight: bold;">print</span> quux <span style="color: red;">4</span></pre></div></div>

]]></content:encoded>
	</item>
</channel>
</rss>

