<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-30218</id>
	<title>Nabble - Scala - Debate</title>
	<updated>2009-11-08T10:13:41Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/Scala---Debate-f30218.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Scala---Debate-f30218.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26256294</id>
	<title>Re: override method parameter default value  specification must not be allowed</title>
	<published>2009-11-08T10:13:41Z</published>
	<updated>2009-11-08T10:13:41Z</updated>
	<author>
		<name>Linas-2</name>
	</author>
	<content type="html">On Sun, 2009-11-08 at 20:25 +0300, Stepan Koltsov wrote:
&lt;br&gt;...
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; Figuratively speaking, ideal language has 100 pages specification and
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; all the best features that can be specified in that 100 pages.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Ideally I would replace dedicated XML treatment with a library DSL and
&lt;br&gt;&amp;gt; &amp;gt; objects with java style statics (since static scope is the only thing I
&lt;br&gt;&amp;gt; &amp;gt; use them for). Would take many pages out of specification. But someone
&lt;br&gt;&amp;gt; &amp;gt; found those usefull.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I don't like XML in Scala language too (although I use it).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I don't understand what are you proposing. AFAIU, Scala language
&lt;br&gt;&amp;gt; cannot be used as a good DSL for XML:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; elem(&amp;quot;html&amp;quot;) {
&lt;br&gt;&amp;gt; &amp;nbsp; elem(&amp;quot;body&amp;quot;, &amp;quot;background&amp;quot; -&amp;gt; &amp;quot;red&amp;quot;) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; text(&amp;quot;hello&amp;quot;)
&lt;br&gt;&amp;gt; &amp;nbsp; }
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You meant this? It is too verbose.
&lt;/div&gt;&lt;br&gt;I was trying to say, that everyone has different ideas on what should go
&lt;br&gt;into language, and what should stay out. Nevermind, not a very important
&lt;br&gt;topic.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; Second, current specification restricts method overloading capabilities:
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; object A {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; def f(x: Int = 1) = 1
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; def f(x: String, z: Int = 2) = 1
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; This is not possible because of JVM bytecode generation scheme (name
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; of default parameter value generator method).
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Using the &amp;quot;object A&amp;quot; above as a source why not simply explode everything
&lt;br&gt;&amp;gt; &amp;gt; into overloaded methods when compiling?
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; def f(x : Int) = ...
&lt;br&gt;&amp;gt; &amp;gt; def f() = { f(1); }
&lt;br&gt;&amp;gt; &amp;gt; def f(x : String, z : Int) = ..
&lt;br&gt;&amp;gt; &amp;gt; def f(x : String) = { f(x, 2); }
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; This allows overloading and default value overriding at the same time.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Avoiding X is always a workaround of any problem of X (X = parameter
&lt;br&gt;&amp;gt; default value)
&lt;/div&gt;&lt;br&gt;I meant, that compiler should do the explosion. You write code with
&lt;br&gt;parameter default values and compiler explodes it into a set of
&lt;br&gt;overloaded methods. Anyway, bad idea.. This would work badly with named
&lt;br&gt;arguments. For number X of default arguments, number of methods after
&lt;br&gt;explosion would be X! . 
&lt;br&gt;&lt;br&gt;Looking at your previous email another approach may work:
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;def connect(String, int) = ...
&lt;br&gt;def connect$params(String, int, parametersMask: Int) =
&lt;br&gt;&amp;nbsp; { setup parameters; connect(p1, p2); }
&lt;br&gt;&lt;br&gt;obj.connect$params(null, 0, 0);
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;&amp;quot;setup parameters&amp;quot; could take default values from a set of generated
&lt;br&gt;methods where each would provide a default value for one parameter. This
&lt;br&gt;would keep a number of generated methods low, allow named arguments,
&lt;br&gt;overloading and overriding (override generated method for overriden
&lt;br&gt;parameter).
&lt;br&gt;&lt;br&gt;&amp;gt; S.
&lt;br&gt;&lt;br&gt;Linas.
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26256294.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26255794</id>
	<title>Re: override method parameter default value  specification must not be allowed</title>
	<published>2009-11-08T09:25:28Z</published>
	<updated>2009-11-08T09:25:28Z</updated>
	<author>
		<name>Stepan Koltsov-2</name>
	</author>
	<content type="html">On Sun, Nov 8, 2009 at 20:07, Linas &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26255794&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vejobrolis@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Sun, 2009-11-08 at 19:21 +0300, Stepan Koltsov wrote:
&lt;br&gt;&amp;gt;&amp;gt; On Sun, Nov 8, 2009 at 18:18, Linas &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26255794&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vejobrolis@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; IMHO it's always better to have a capability and not need it than to
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; need a capability and not have it.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; First, possibility to override default values makes specification larger.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Language must be as small as possible. It cannot (and must not)
&lt;br&gt;&amp;gt;&amp;gt; contain all possible features invented in 50 years of programming.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Figuratively speaking, ideal language has 100 pages specification and
&lt;br&gt;&amp;gt;&amp;gt; all the best features that can be specified in that 100 pages.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Ideally I would replace dedicated XML treatment with a library DSL and
&lt;br&gt;&amp;gt; objects with java style statics (since static scope is the only thing I
&lt;br&gt;&amp;gt; use them for). Would take many pages out of specification. But someone
&lt;br&gt;&amp;gt; found those usefull.
&lt;/div&gt;&lt;br&gt;I don't like XML in Scala language too (although I use it).
&lt;br&gt;&lt;br&gt;I don't understand what are you proposing. AFAIU, Scala language
&lt;br&gt;cannot be used as a good DSL for XML:
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;elem(&amp;quot;html&amp;quot;) {
&lt;br&gt;&amp;nbsp; elem(&amp;quot;body&amp;quot;, &amp;quot;background&amp;quot; -&amp;gt; &amp;quot;red&amp;quot;) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; text(&amp;quot;hello&amp;quot;)
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;You meant this? It is too verbose.
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; Second, current specification restricts method overloading capabilities:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;&amp;gt; object A {
&lt;br&gt;&amp;gt;&amp;gt;     def f(x: Int = 1) = 1
&lt;br&gt;&amp;gt;&amp;gt;     def f(x: String, z: Int = 2) = 1
&lt;br&gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; This is not possible because of JVM bytecode generation scheme (name
&lt;br&gt;&amp;gt;&amp;gt; of default parameter value generator method).
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Using the &amp;quot;object A&amp;quot; above as a source why not simply explode everything
&lt;br&gt;&amp;gt; into overloaded methods when compiling?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; def f(x : Int) = ...
&lt;br&gt;&amp;gt; def f() = { f(1); }
&lt;br&gt;&amp;gt; def f(x : String, z : Int) = ..
&lt;br&gt;&amp;gt; def f(x : String) = { f(x, 2); }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This allows overloading and default value overriding at the same time.
&lt;/div&gt;&lt;br&gt;Avoiding X is always a workaround of any problem of X (X = parameter
&lt;br&gt;default value)
&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26255794.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26255628</id>
	<title>Re: override method parameter default value  specification must not be allowed</title>
	<published>2009-11-08T09:07:50Z</published>
	<updated>2009-11-08T09:07:50Z</updated>
	<author>
		<name>Linas-2</name>
	</author>
	<content type="html">On Sun, 2009-11-08 at 19:21 +0300, Stepan Koltsov wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Sun, Nov 8, 2009 at 18:18, Linas &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26255628&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vejobrolis@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; &amp;gt; IMHO it's always better to have a capability and not need it than to
&lt;br&gt;&amp;gt; &amp;gt; need a capability and not have it.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; First, possibility to override default values makes specification larger.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Language must be as small as possible. It cannot (and must not)
&lt;br&gt;&amp;gt; contain all possible features invented in 50 years of programming.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Figuratively speaking, ideal language has 100 pages specification and
&lt;br&gt;&amp;gt; all the best features that can be specified in that 100 pages.
&lt;/div&gt;&lt;br&gt;Ideally I would replace dedicated XML treatment with a library DSL and
&lt;br&gt;objects with java style statics (since static scope is the only thing I
&lt;br&gt;use them for). Would take many pages out of specification. But someone
&lt;br&gt;found those usefull. 
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Second, current specification restricts method overloading capabilities:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; object A {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; def f(x: Int = 1) = 1
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; def f(x: String, z: Int = 2) = 1
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; This is not possible because of JVM bytecode generation scheme (name
&lt;br&gt;&amp;gt; of default parameter value generator method).
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Third (I said this earlier), current spec makes larger and slower bytecode.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; def connect(host = &amp;quot;localhost&amp;quot;, port = 1234) = ...
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; connect()
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; compiled to:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; def connect(Strng, Int) = ...
&lt;br&gt;&amp;gt; def connect$default$1 = &amp;quot;localhost&amp;quot;
&lt;br&gt;&amp;gt; def connect$default$2(String) = 1234
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; obj.connect(obj.connect$default$1,
&lt;br&gt;&amp;gt; obj.connect$default$2(obj.connect$default$1)).
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Size of both classes (caller and callee) increased by size of two
&lt;br&gt;&amp;gt; string constants&amp;quot;connect$default$1&amp;quot; and &amp;quot;connect$default$2&amp;quot;), caller
&lt;br&gt;&amp;gt; has two extra method call, calee has extra method, JVM consumes more
&lt;br&gt;&amp;gt; memory, inlines fewer and so on.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Alternative compilation scheme (that was in the first version of
&lt;br&gt;&amp;gt; specification) compiles &amp;quot;connect&amp;quot; method as:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; def connect(String, int) = ...
&lt;br&gt;&amp;gt; def connect$params(String, int, parametersMask: Int) =
&lt;br&gt;&amp;gt; &amp;nbsp; { setup parameters; connect(p1, p2); }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; obj.connect$params(null, 0, 0);
&lt;br&gt;&amp;gt; ===
&lt;/div&gt;&lt;br&gt;Using the &amp;quot;object A&amp;quot; above as a source why not simply explode everything
&lt;br&gt;into overloaded methods when compiling?
&lt;br&gt;&lt;br&gt;def f(x : Int) = ...
&lt;br&gt;def f() = { f(1); }
&lt;br&gt;def f(x : String, z : Int) = ..
&lt;br&gt;def f(x : String) = { f(x, 2); }
&lt;br&gt;&lt;br&gt;This allows overloading and default value overriding at the same time.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; But it does not allow (useless and weird) parameter default value overriding.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; S.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; On Sun, 2009-11-08 at 16:28 +0300, Stepan Koltsov wrote:
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; while Scala 2.8 is not yet released, I have an addition to SID 1
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; (named and default args; simplification): disallow default parameter
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; value specfication in override method.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; I believe, there are no reasons of specifying default value in
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; override method. I seems to be cool, but is is useless.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; And also, sometimes it is confusing.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp;abstract class A {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; def connect(port: Int = 12345)
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; class B extends A {
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; override def connect(port: Int = 99999) { println(&amp;quot;connecting to &amp;quot;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; + port); }
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; val a: A = new B
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; a.connect()
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;quot;connects&amp;quot; to 99999. However, I expect port value 12345.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; Code above should fail to be compiled.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; In the specification, sentence
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;quot;The subclass can also override default arguments and add new ones to
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; parameters which don’t have a default in the superclass.&amp;quot;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; should be replaced with
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; &amp;quot;The overriding method cannot specify any default method parameters,
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; default values from the base class method are inherited&amp;quot;.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; This change will make specification simpler.
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;&amp;gt; S.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26255628.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26255532</id>
	<title>Re: override method parameter default value 	specification must not be allowed</title>
	<published>2009-11-08T08:49:40Z</published>
	<updated>2009-11-08T08:49:40Z</updated>
	<author>
		<name>phkoester</name>
	</author>
	<content type="html">&amp;gt; The argument that this kind of overriding is broken trivially
&lt;br&gt;&amp;gt; generalises to &amp;quot;subtyping is broken&amp;quot;.
&lt;br&gt;&lt;br&gt;I just wanted to write the same. For the same reason one might argue 
&lt;br&gt;``if `a' is declared to be of type `A', then it is not desired to behave 
&lt;br&gt;like a `B'.&amp;quot; If you agree with that, you probably don't like subtyping 
&lt;br&gt;and polymorphism at all ...
&lt;br&gt;&lt;br&gt;I think it is a good thing that default args are overridable. This is 
&lt;br&gt;perfectly in line with polymorphism.
&lt;br&gt;&lt;br&gt;&amp;gt; I might agree with that.
&lt;br&gt;&lt;br&gt;As my programming experience grew throught the years, I discovered that 
&lt;br&gt;I more and more favor composition over inheritance. Complex class 
&lt;br&gt;hierarchies may be impressive to others---in general, they make me 
&lt;br&gt;suspicious. :) Nonetheless, I'd be interested to hear the reasons, in a 
&lt;br&gt;sentence or two, why you are spectical about subtyping as a whole.
&lt;br&gt;&lt;br&gt;---Ph
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26255532.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26255362</id>
	<title>Re: override method parameter default value  specification must not be allowed</title>
	<published>2009-11-08T08:38:42Z</published>
	<updated>2009-11-08T08:38:42Z</updated>
	<author>
		<name>Stepan Koltsov-2</name>
	</author>
	<content type="html">On Sun, Nov 8, 2009 at 18:56, Andrew Gaydenko &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26255362&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;a@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; And, after all, what is that big difference in comparison with val o def
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; overriding?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Method parameter belongs to method of class, val belongs to class.
&lt;br&gt;&amp;gt;&amp;gt; Vals and method parameter defaults are very different things.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Rephrasing: method parameter belongs to method of class, method belongs to
&lt;br&gt;&amp;gt; class, i.e. method parameter belongs to class in total :-)
&lt;br&gt;&lt;br&gt;... and they both belong to universe. But you've asked what is the
&lt;br&gt;difference, and I explained.
&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26255362.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26255323</id>
	<title>Re: override method parameter default value  specification must not be allowed</title>
	<published>2009-11-08T08:34:06Z</published>
	<updated>2009-11-08T08:34:06Z</updated>
	<author>
		<name>Stepan Koltsov-2</name>
	</author>
	<content type="html">On Sun, Nov 8, 2009 at 18:56, Andrew Gaydenko &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26255323&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;a@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Sunday 08 November 2009 18:39:10 Stepan Koltsov wrote:
&lt;br&gt;&amp;gt;&amp;gt; Yes, I know it is 99999, because I know that I called B instance
&lt;br&gt;&amp;gt;&amp;gt; (although I had to read spec). However, I meant the case where type of
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;a&amp;quot; variable is not known to be B at the call site.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;&amp;gt; val a: A = someFunc()
&lt;br&gt;&amp;gt;&amp;gt; a.connect()
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I think it's matter of taste. To my mind, &amp;quot;someFunc() knows itself&amp;quot; is more
&lt;br&gt;&amp;gt; expectable.
&lt;/div&gt;&lt;br&gt;Actually, I doubt someone's really going to override parameter default
&lt;br&gt;value (as it makes program harder to understand).
&lt;br&gt;&lt;br&gt;I have an example, where parameter default value overriding maybe
&lt;br&gt;useful (and later I'll show that it is bad use).
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;trait DbConnector {
&lt;br&gt;&amp;nbsp; def conect(host: String, port: Int = 0) // port is database specific
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;class MysqlConnector {
&lt;br&gt;&amp;nbsp; override def connect(host: String, port: Int = 3306) // default port for MySQL
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;class PostgresqlConnector {
&lt;br&gt;&amp;nbsp; override def connect(host: String, port: Int = 5432) // default port
&lt;br&gt;for PostgreSQL
&lt;br&gt;}
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;This seems to be a good example of parameter default value overriding.
&lt;br&gt;But it is not, because I cannot write a class:
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;class MagicDbConnectorProxy { // that delegates to vendor-specific
&lt;br&gt;&amp;nbsp; override def connect(host: String, port: Int = ???) // what value
&lt;br&gt;should I use?
&lt;br&gt;}
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;When parameter default value depends on class type, special marker
&lt;br&gt;(for example, zero) should be used to indicate the default value, like
&lt;br&gt;this:
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;trait DbConnector {
&lt;br&gt;&amp;nbsp; def conect(host: String, port: Int = 0) // port is database specific
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;class MysqlConnector {
&lt;br&gt;&amp;nbsp; override def connect(host: String, port: Int) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (port == 0) port = 3306;
&lt;br&gt;&amp;nbsp; &amp;nbsp; ...
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;This is how code should be written even if parameter default value can
&lt;br&gt;be overriden.
&lt;br&gt;&lt;br&gt;IMHO.
&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26255323.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26255207</id>
	<title>Re: override method parameter default value  specification must not be allowed</title>
	<published>2009-11-08T08:21:26Z</published>
	<updated>2009-11-08T08:21:26Z</updated>
	<author>
		<name>Stepan Koltsov-2</name>
	</author>
	<content type="html">On Sun, Nov 8, 2009 at 18:18, Linas &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26255207&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vejobrolis@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; IMHO it's always better to have a capability and not need it than to
&lt;br&gt;&amp;gt; need a capability and not have it.
&lt;br&gt;&lt;br&gt;&lt;br&gt;First, possibility to override default values makes specification larger.
&lt;br&gt;&lt;br&gt;Language must be as small as possible. It cannot (and must not)
&lt;br&gt;contain all possible features invented in 50 years of programming.
&lt;br&gt;&lt;br&gt;Figuratively speaking, ideal language has 100 pages specification and
&lt;br&gt;all the best features that can be specified in that 100 pages.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Second, current specification restricts method overloading capabilities:
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;object A {
&lt;br&gt;&amp;nbsp; &amp;nbsp; def f(x: Int = 1) = 1
&lt;br&gt;&amp;nbsp; &amp;nbsp; def f(x: String, z: Int = 2) = 1
&lt;br&gt;}
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;This is not possible because of JVM bytecode generation scheme (name
&lt;br&gt;of default parameter value generator method).
&lt;br&gt;&lt;br&gt;Third (I said this earlier), current spec makes larger and slower bytecode.
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;def connect(host = &amp;quot;localhost&amp;quot;, port = 1234) = ...
&lt;br&gt;&lt;br&gt;connect()
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;compiled to:
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;def connect(Strng, Int) = ...
&lt;br&gt;def connect$default$1 = &amp;quot;localhost&amp;quot;
&lt;br&gt;def connect$default$2(String) = 1234
&lt;br&gt;&lt;br&gt;obj.connect(obj.connect$default$1,
&lt;br&gt;obj.connect$default$2(obj.connect$default$1)).
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;Size of both classes (caller and callee) increased by size of two
&lt;br&gt;string constants&amp;quot;connect$default$1&amp;quot; and &amp;quot;connect$default$2&amp;quot;), caller
&lt;br&gt;has two extra method call, calee has extra method, JVM consumes more
&lt;br&gt;memory, inlines fewer and so on.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Alternative compilation scheme (that was in the first version of
&lt;br&gt;specification) compiles &amp;quot;connect&amp;quot; method as:
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;def connect(String, int) = ...
&lt;br&gt;def connect$params(String, int, parametersMask: Int) =
&lt;br&gt;&amp;nbsp; { setup parameters; connect(p1, p2); }
&lt;br&gt;&lt;br&gt;obj.connect$params(null, 0, 0);
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;But it does not allow (useless and weird) parameter default value overriding.
&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Sun, 2009-11-08 at 16:28 +0300, Stepan Koltsov wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; while Scala 2.8 is not yet released, I have an addition to SID 1
&lt;br&gt;&amp;gt;&amp;gt; (named and default args; simplification): disallow default parameter
&lt;br&gt;&amp;gt;&amp;gt; value specfication in override method.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I believe, there are no reasons of specifying default value in
&lt;br&gt;&amp;gt;&amp;gt; override method. I seems to be cool, but is is useless.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; And also, sometimes it is confusing.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;&amp;gt;  abstract class A {
&lt;br&gt;&amp;gt;&amp;gt;     def connect(port: Int = 12345)
&lt;br&gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; class B extends A {
&lt;br&gt;&amp;gt;&amp;gt;     override def connect(port: Int = 99999) { println(&amp;quot;connecting to &amp;quot;
&lt;br&gt;&amp;gt;&amp;gt; + port); }
&lt;br&gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; val a: A = new B
&lt;br&gt;&amp;gt;&amp;gt; a.connect()
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;connects&amp;quot; to 99999. However, I expect port value 12345.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Code above should fail to be compiled.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; In the specification, sentence
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;The subclass can also override default arguments and add new ones to
&lt;br&gt;&amp;gt;&amp;gt; parameters which don’t have a default in the superclass.&amp;quot;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; should be replaced with
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;The overriding method cannot specify any default method parameters,
&lt;br&gt;&amp;gt;&amp;gt; default values from the base class method are inherited&amp;quot;.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; This change will make specification simpler.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; S.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26255207.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26255183</id>
	<title>Re: override method parameter default value  specification must not be allowed</title>
	<published>2009-11-08T08:18:52Z</published>
	<updated>2009-11-08T08:18:52Z</updated>
	<author>
		<name>Ricky Clarkson</name>
	</author>
	<content type="html">The argument that this kind of overriding is broken trivially
&lt;br&gt;generalises to &amp;quot;subtyping is broken&amp;quot;. &amp;nbsp;I might agree with that, but
&lt;br&gt;given Scala, a language that supports subtyping, this kind of
&lt;br&gt;overriding is no more harmful than any other.
&lt;br&gt;&lt;br&gt;2009/11/8 Andrew Gaydenko &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26255183&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;a@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Sunday 08 November 2009 18:39:10 Stepan Koltsov wrote:
&lt;br&gt;&amp;gt;&amp;gt; Yes, I know it is 99999, because I know that I called B instance
&lt;br&gt;&amp;gt;&amp;gt; (although I had to read spec). However, I meant the case where type of
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;a&amp;quot; variable is not known to be B at the call site.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;&amp;gt; val a: A = someFunc()
&lt;br&gt;&amp;gt;&amp;gt; a.connect()
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I think it's matter of taste. To my mind, &amp;quot;someFunc() knows itself&amp;quot; is more
&lt;br&gt;&amp;gt; expectable.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; And, after all, what is that big difference in comparison with val o def
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; overriding?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Method parameter belongs to method of class, val belongs to class.
&lt;br&gt;&amp;gt;&amp;gt; Vals and method parameter defaults are very different things.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; S.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Rephrasing: method parameter belongs to method of class, method belongs to
&lt;br&gt;&amp;gt; class, i.e. method parameter belongs to class in total :-)
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Ricky Clarkson
&lt;br&gt;Java and Scala Programmer, AD Holdings
&lt;br&gt;+44 1565 770804
&lt;br&gt;Skype: ricky_clarkson
&lt;br&gt;Google Talk: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26255183&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ricky.clarkson@...&lt;/a&gt;
&lt;br&gt;Google Wave: &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26255183&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;ricky.clarkson@...&lt;/a&gt;
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26255183.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26255005</id>
	<title>Re: override method parameter default value specification must not be allowed</title>
	<published>2009-11-08T07:56:58Z</published>
	<updated>2009-11-08T07:56:58Z</updated>
	<author>
		<name>Andrew Gaydenko</name>
	</author>
	<content type="html">On Sunday 08 November 2009 18:39:10 Stepan Koltsov wrote:
&lt;br&gt;&amp;gt; Yes, I know it is 99999, because I know that I called B instance
&lt;br&gt;&amp;gt; (although I had to read spec). However, I meant the case where type of
&lt;br&gt;&amp;gt; &amp;quot;a&amp;quot; variable is not known to be B at the call site.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; val a: A = someFunc()
&lt;br&gt;&amp;gt; a.connect()
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&lt;br&gt;I think it's matter of taste. To my mind, &amp;quot;someFunc() knows itself&amp;quot; is more 
&lt;br&gt;expectable.
&lt;br&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt; And, after all, what is that big difference in comparison with val o def
&lt;br&gt;&amp;gt; &amp;gt; overriding?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Method parameter belongs to method of class, val belongs to class.
&lt;br&gt;&amp;gt; Vals and method parameter defaults are very different things.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; S.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;br&gt;Rephrasing: method parameter belongs to method of class, method belongs to 
&lt;br&gt;class, i.e. method parameter belongs to class in total :-)
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26255005.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26254943</id>
	<title>Re: override method parameter default value specification must not be allowed</title>
	<published>2009-11-08T07:51:54Z</published>
	<updated>2009-11-08T07:51:54Z</updated>
	<author>
		<name>Francois Armand-2</name>
	</author>
	<content type="html">On 08/11/2009 16:39, Stepan Koltsov wrote:
&lt;br&gt;&amp;gt; On Sun, Nov 8, 2009 at 18:16, Andrew Gaydenko&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26254943&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;a@...&lt;/a&gt;&amp;gt; &amp;nbsp;wrote:
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; val a: A = someFunc()
&lt;br&gt;&amp;gt; a.connect()
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&lt;br&gt;Contrary to what you think, I believe that this is the perfect use case 
&lt;br&gt;for default parameter value override.
&lt;br&gt;With or without default parameter override, you can change the port 
&lt;br&gt;value, for example:
&lt;br&gt;&lt;br&gt;override def connect(port: Int) {
&lt;br&gt;//ignore the arg and connect to my default port, because it's my
&lt;br&gt;//specifity of being a B
&lt;br&gt;println(&amp;quot;connecting to &amp;quot; + myDefaultPort)
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;If you use a B for your A, it means that you want the specialized 
&lt;br&gt;behaviour that comes with B, and perhaps it has nothing to do with the 
&lt;br&gt;parent behaviour, but that's nothing new.
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Francois Armand
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26254943.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26254826</id>
	<title>Re: override method parameter default value  specification must not be allowed</title>
	<published>2009-11-08T07:39:10Z</published>
	<updated>2009-11-08T07:39:10Z</updated>
	<author>
		<name>Stepan Koltsov-5</name>
	</author>
	<content type="html">On Sun, Nov 8, 2009 at 18:16, Andrew Gaydenko &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26254826&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;a@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; And also, sometimes it is confusing.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;&amp;gt;  abstract class A {
&lt;br&gt;&amp;gt;&amp;gt;     def connect(port: Int = 12345)
&lt;br&gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; class B extends A {
&lt;br&gt;&amp;gt;&amp;gt;     override def connect(port: Int = 99999) { println(&amp;quot;connecting to &amp;quot;
&lt;br&gt;&amp;gt;&amp;gt; + port); }
&lt;br&gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; val a: A = new B
&lt;br&gt;&amp;gt;&amp;gt; a.connect()
&lt;br&gt;&amp;gt;&amp;gt; ===
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;quot;connects&amp;quot; to 99999. However, I expect port value 12345.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Code above should fail to be compiled.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hm.. I would expect 99999 as long as new B is creating. Do you say 'new B'
&lt;br&gt;&amp;gt; contract (the way an instance is created) must depend on left side?
&lt;/div&gt;&lt;br&gt;Yes, I know it is 99999, because I know that I called B instance
&lt;br&gt;(although I had to read spec). However, I meant the case where type of
&lt;br&gt;&amp;quot;a&amp;quot; variable is not known to be B at the call site.
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;val a: A = someFunc()
&lt;br&gt;a.connect()
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;&amp;gt; And, after all, what is that big difference in comparison with val o def
&lt;br&gt;&amp;gt; overriding?
&lt;br&gt;&lt;br&gt;Method parameter belongs to method of class, val belongs to class.
&lt;br&gt;Vals and method parameter defaults are very different things.
&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26254826.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26254649</id>
	<title>Re: override method parameter default value specification must not be  allowed</title>
	<published>2009-11-08T07:18:34Z</published>
	<updated>2009-11-08T07:18:34Z</updated>
	<author>
		<name>Linas-2</name>
	</author>
	<content type="html">IMHO it's always better to have a capability and not need it than to
&lt;br&gt;need a capability and not have it.
&lt;br&gt;&lt;br&gt;Linas.
&lt;br&gt;&lt;br&gt;On Sun, 2009-11-08 at 16:28 +0300, Stepan Koltsov wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; while Scala 2.8 is not yet released, I have an addition to SID 1
&lt;br&gt;&amp;gt; (named and default args; simplification): disallow default parameter
&lt;br&gt;&amp;gt; value specfication in override method.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I believe, there are no reasons of specifying default value in
&lt;br&gt;&amp;gt; override method. I seems to be cool, but is is useless.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; And also, sometimes it is confusing.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; &amp;nbsp;abstract class A {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; def connect(port: Int = 12345)
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; class B extends A {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; override def connect(port: Int = 99999) { println(&amp;quot;connecting to &amp;quot;
&lt;br&gt;&amp;gt; + port); }
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; val a: A = new B
&lt;br&gt;&amp;gt; a.connect()
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;quot;connects&amp;quot; to 99999. However, I expect port value 12345.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Code above should fail to be compiled.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; In the specification, sentence
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;quot;The subclass can also override default arguments and add new ones to
&lt;br&gt;&amp;gt; parameters which don’t have a default in the superclass.&amp;quot;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; should be replaced with
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;quot;The overriding method cannot specify any default method parameters,
&lt;br&gt;&amp;gt; default values from the base class method are inherited&amp;quot;.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; This change will make specification simpler.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; S.
&lt;/div&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26254649.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26254628</id>
	<title>Re: override method parameter default value specification must not be allowed</title>
	<published>2009-11-08T07:16:06Z</published>
	<updated>2009-11-08T07:16:06Z</updated>
	<author>
		<name>Andrew Gaydenko</name>
	</author>
	<content type="html">On Sunday 08 November 2009 16:28:27 Stepan Koltsov wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; while Scala 2.8 is not yet released, I have an addition to SID 1
&lt;br&gt;&amp;gt; (named and default args; simplification): disallow default parameter
&lt;br&gt;&amp;gt; value specfication in override method.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I believe, there are no reasons of specifying default value in
&lt;br&gt;&amp;gt; override method. I seems to be cool, but is is useless.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; And also, sometimes it is confusing.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; &amp;nbsp;abstract class A {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; def connect(port: Int = 12345)
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; class B extends A {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; override def connect(port: Int = 99999) { println(&amp;quot;connecting to &amp;quot;
&lt;br&gt;&amp;gt; + port); }
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; val a: A = new B
&lt;br&gt;&amp;gt; a.connect()
&lt;br&gt;&amp;gt; ===
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;quot;connects&amp;quot; to 99999. However, I expect port value 12345.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Code above should fail to be compiled.
&lt;/div&gt;&lt;br&gt;Hm.. I would expect 99999 as long as new B is creating. Do you say 'new B' 
&lt;br&gt;contract (the way an instance is created) must depend on left side?
&lt;br&gt;&lt;br&gt;And, after all, what is that big difference in comparison with val o def 
&lt;br&gt;overriding?
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26254628.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26253785</id>
	<title>override method parameter default value specification must not be  allowed</title>
	<published>2009-11-08T05:28:27Z</published>
	<updated>2009-11-08T05:28:27Z</updated>
	<author>
		<name>Stepan Koltsov</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;while Scala 2.8 is not yet released, I have an addition to SID 1
&lt;br&gt;(named and default args; simplification): disallow default parameter
&lt;br&gt;value specfication in override method.
&lt;br&gt;&lt;br&gt;I believe, there are no reasons of specifying default value in
&lt;br&gt;override method. I seems to be cool, but is is useless.
&lt;br&gt;&lt;br&gt;And also, sometimes it is confusing.
&lt;br&gt;&lt;br&gt;===
&lt;br&gt;&amp;nbsp;abstract class A {
&lt;br&gt;&amp;nbsp; &amp;nbsp; def connect(port: Int = 12345)
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;class B extends A {
&lt;br&gt;&amp;nbsp; &amp;nbsp; override def connect(port: Int = 99999) { println(&amp;quot;connecting to &amp;quot;
&lt;br&gt;+ port); }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;val a: A = new B
&lt;br&gt;a.connect()
&lt;br&gt;===
&lt;br&gt;&lt;br&gt;&amp;quot;connects&amp;quot; to 99999. However, I expect port value 12345.
&lt;br&gt;&lt;br&gt;Code above should fail to be compiled.
&lt;br&gt;&lt;br&gt;In the specification, sentence
&lt;br&gt;&lt;br&gt;&amp;quot;The subclass can also override default arguments and add new ones to
&lt;br&gt;parameters which don’t have a default in the superclass.&amp;quot;
&lt;br&gt;&lt;br&gt;should be replaced with
&lt;br&gt;&lt;br&gt;&amp;quot;The overriding method cannot specify any default method parameters,
&lt;br&gt;default values from the base class method are inherited&amp;quot;.
&lt;br&gt;&lt;br&gt;This change will make specification simpler.
&lt;br&gt;&lt;br&gt;S.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/override-method-parameter-default-value-specification-must-not-be--allowed-tp26253785p26253785.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26219494</id>
	<title>Re: Microsoft and Scala .net</title>
	<published>2009-11-05T10:01:35Z</published>
	<updated>2009-11-05T10:01:35Z</updated>
	<author>
		<name>Lukas Rytz</name>
	</author>
	<content type="html">Right, sorry I should be a bit more specific.&lt;br&gt;&lt;br&gt;Partest compiles and runs tests, and compares the output (either from the compiler&lt;br&gt;or from the program) with a corresponding &amp;quot;.check&amp;quot; file. It does so in parallel.&lt;br&gt;
&lt;br&gt;There are (mainly) four kinds of tests:&lt;br&gt; - neg: should not compile (compare compiler output with check file)&lt;br&gt; - pos: should compile (no output)&lt;br&gt; - run: compile, run, compare output with check file&lt;br&gt; - jvm: like run, but expected to work only on jvm&lt;br&gt;
&lt;br&gt;before partest, we used a bash script called &amp;quot;scalatest&amp;quot;. This script actually supported&lt;br&gt;testing the .NET backend. I don&amp;#39;t know how well it worked. The script was removed in&lt;br&gt;revision 17595,&lt;br&gt;&lt;a href=&quot;http://lampsvn.epfl.ch/trac/scala/changeset/17595/scala/trunk/test&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lampsvn.epfl.ch/trac/scala/changeset/17595/scala/trunk/test&lt;/a&gt;&lt;br&gt;
&lt;br&gt;Thanks: Lukas&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Nov 5, 2009 at 18:47, Josh Cough &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26219494&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;joshcough@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
partest runs tests right? lets say we put something together that also runs those same tests. what percentage of them would still be usable? i looked through it briefly a few times and seems like we could probably make use of a good chunk of the tests. &lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;
&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Nov 5, 2009 at 11:42 AM, Lukas Rytz &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26219494&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;lukas.rytz@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;div&gt;On Thu, Nov 5, 2009 at 16:43, Josh Cough &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26219494&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;joshcough@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;


I&amp;#39;d be very interested in putting together a test suite for Scala.NET. My first question would be, what prevents the existing tests from running? I&amp;#39;d like to hope that many of the test would be salvageable. &lt;br&gt;&lt;/blockquote&gt;


&lt;/div&gt;&lt;div&gt;&lt;br&gt;First problem is that partest uses actors, and they don&amp;#39;t exist in Scala.NET :)&lt;br&gt;&lt;br&gt; &lt;/div&gt;&lt;div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;


&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;
&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Nov 5, 2009 at 8:03 AM, Lukas Rytz &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26219494&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;lukas.rytz@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;



The .NET version is very much work in progress. The .NET backend is mostly&lt;br&gt;working, so you can compile to MSIL (using a compiler running on the JVM).&lt;br&gt;&lt;br&gt;We&amp;#39;re working on bootstrapping the compiler on .NET.&lt;br&gt;


&lt;br&gt;

A central issue we&amp;#39;re having right now is that there is &lt;b&gt;no test suite&lt;/b&gt; (zero tests)&lt;br&gt;for Scala.NET, so we don&amp;#39;t really know what the quality of the generated code is.&lt;br&gt;&lt;br&gt;Help from the community would be very much appreciated!&lt;br&gt;



&lt;font color=&quot;#888888&quot;&gt;
&lt;br&gt;Lukas&lt;/font&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Nov 5, 2009 at 12:36, Marcus Downing &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26219494&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;marcus@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;



&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;br&gt;
As spotted on Planet Scala, Erik Engbrecht recently tweeted:&lt;br&gt;
&lt;br&gt;
  &amp;quot;.NET version of #scala sponsored by Microsoft probably sometime next year&lt;br&gt;
#scalaliftoff&amp;quot;&lt;br&gt;
&lt;br&gt;
and&lt;br&gt;
&lt;br&gt;
  &amp;quot;EPFL almost has a #scala compiler that runs natively on .net and should&lt;br&gt;
have it by the end of the year #scalaliftoff&amp;quot;&lt;br&gt;
&lt;br&gt;
...but I&amp;#39;ve seen nothing more about it, anywhere. Is this real or just&lt;br&gt;
random electron chatter? Is it supposed to be still under wraps?&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;--&lt;br&gt;
View this message in context: &lt;a href=&quot;http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26211695.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26211695.html&lt;/a&gt;&lt;br&gt;
Sent from the Scala - Debate mailing list archive at Nabble.com.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26219494.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26219164</id>
	<title>Re: Microsoft and Scala .net</title>
	<published>2009-11-05T09:42:43Z</published>
	<updated>2009-11-05T09:42:43Z</updated>
	<author>
		<name>Lukas Rytz</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Nov 5, 2009 at 16:43, Josh Cough &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26219164&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;joshcough@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
I&amp;#39;d be very interested in putting together a test suite for Scala.NET. My first question would be, what prevents the existing tests from running? I&amp;#39;d like to hope that many of the test would be salvageable. &lt;br&gt;&lt;/blockquote&gt;
&lt;div&gt;&lt;br&gt;First problem is that partest uses actors, and they don&amp;#39;t exist in Scala.NET :)&lt;br&gt;&lt;br&gt; &lt;/div&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;h5&quot;&gt;&lt;br&gt;
&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Nov 5, 2009 at 8:03 AM, Lukas Rytz &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26219164&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;lukas.rytz@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

The .NET version is very much work in progress. The .NET backend is mostly&lt;br&gt;working, so you can compile to MSIL (using a compiler running on the JVM).&lt;br&gt;&lt;br&gt;We&amp;#39;re working on bootstrapping the compiler on .NET.&lt;br&gt;
&lt;br&gt;

A central issue we&amp;#39;re having right now is that there is &lt;b&gt;no test suite&lt;/b&gt; (zero tests)&lt;br&gt;for Scala.NET, so we don&amp;#39;t really know what the quality of the generated code is.&lt;br&gt;&lt;br&gt;Help from the community would be very much appreciated!&lt;br&gt;

&lt;font color=&quot;#888888&quot;&gt;
&lt;br&gt;Lukas&lt;/font&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Nov 5, 2009 at 12:36, Marcus Downing &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26219164&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;marcus@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;

&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;br&gt;
As spotted on Planet Scala, Erik Engbrecht recently tweeted:&lt;br&gt;
&lt;br&gt;
  &amp;quot;.NET version of #scala sponsored by Microsoft probably sometime next year&lt;br&gt;
#scalaliftoff&amp;quot;&lt;br&gt;
&lt;br&gt;
and&lt;br&gt;
&lt;br&gt;
  &amp;quot;EPFL almost has a #scala compiler that runs natively on .net and should&lt;br&gt;
have it by the end of the year #scalaliftoff&amp;quot;&lt;br&gt;
&lt;br&gt;
...but I&amp;#39;ve seen nothing more about it, anywhere. Is this real or just&lt;br&gt;
random electron chatter? Is it supposed to be still under wraps?&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;--&lt;br&gt;
View this message in context: &lt;a href=&quot;http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26211695.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26211695.html&lt;/a&gt;&lt;br&gt;
Sent from the Scala - Debate mailing list archive at Nabble.com.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26219164.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26215167</id>
	<title>Re: Microsoft and Scala .net</title>
	<published>2009-11-05T06:03:33Z</published>
	<updated>2009-11-05T06:03:33Z</updated>
	<author>
		<name>Lukas Rytz</name>
	</author>
	<content type="html">The .NET version is very much work in progress. The .NET backend is mostly&lt;br&gt;working, so you can compile to MSIL (using a compiler running on the JVM).&lt;br&gt;&lt;br&gt;We&amp;#39;re working on bootstrapping the compiler on .NET.&lt;br&gt;&lt;br&gt;
A central issue we&amp;#39;re having right now is that there is &lt;b&gt;no test suite&lt;/b&gt; (zero tests)&lt;br&gt;for Scala.NET, so we don&amp;#39;t really know what the quality of the generated code is.&lt;br&gt;&lt;br&gt;Help from the community would be very much appreciated!&lt;br&gt;
&lt;br&gt;Lukas&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Nov 5, 2009 at 12:36, Marcus Downing &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26215167&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;marcus@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;br&gt;
As spotted on Planet Scala, Erik Engbrecht recently tweeted:&lt;br&gt;
&lt;br&gt;
  &amp;quot;.NET version of #scala sponsored by Microsoft probably sometime next year&lt;br&gt;
#scalaliftoff&amp;quot;&lt;br&gt;
&lt;br&gt;
and&lt;br&gt;
&lt;br&gt;
  &amp;quot;EPFL almost has a #scala compiler that runs natively on .net and should&lt;br&gt;
have it by the end of the year #scalaliftoff&amp;quot;&lt;br&gt;
&lt;br&gt;
...but I&amp;#39;ve seen nothing more about it, anywhere. Is this real or just&lt;br&gt;
random electron chatter? Is it supposed to be still under wraps?&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;--&lt;br&gt;
View this message in context: &lt;a href=&quot;http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26211695.html&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26211695.html&lt;/a&gt;&lt;br&gt;
Sent from the Scala - Debate mailing list archive at Nabble.com.&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26215167.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26211695</id>
	<title>Microsoft and Scala .net</title>
	<published>2009-11-05T03:36:50Z</published>
	<updated>2009-11-05T03:36:50Z</updated>
	<author>
		<name>Marcus Downing</name>
	</author>
	<content type="html">As spotted on Planet Scala, Erik Engbrecht recently tweeted:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;quot;.NET version of #scala sponsored by Microsoft probably sometime next year #scalaliftoff&amp;quot;
&lt;br&gt;&lt;br&gt;and
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;quot;EPFL almost has a #scala compiler that runs natively on .net and should have it by the end of the year #scalaliftoff&amp;quot;
&lt;br&gt;&lt;br&gt;...but I've seen nothing more about it, anywhere. Is this real or just random electron chatter? Is it supposed to be still under wraps?</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Microsoft-and-Scala-.net-tp26211695p26211695.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26208584</id>
	<title>Re: Adding Bagwell's Trie to the collection: 	benchmarks</title>
	<published>2009-11-04T22:08:10Z</published>
	<updated>2009-11-04T22:08:10Z</updated>
	<author>
		<name>Ben Jackman</name>
	</author>
	<content type="html">In the meantime before 2.8 stabilized, I know that Daniel Spiewak reimplemented the Clojure PersistentHashMap in Scala, this might be useful to you for the time being:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://github.com/djspiewak/scala-collections&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://github.com/djspiewak/scala-collections&lt;/a&gt;&lt;br&gt;&lt;br&gt;Caveat Emptor: I haven't tried it out so I am not sure it works correctly / what the performance is like.
&lt;br&gt;&lt;br&gt;Ben
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Ismael Juma wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;Michel Alexandre Salim &amp;lt;michael.silvanus &amp;lt;at&amp;gt; gmail.com&amp;gt; writes:
&lt;br&gt;&amp;gt; I suppose we can't use the Clojure code, since it's more strictly
&lt;br&gt;&amp;gt; licensed (EPL rather than BSD) -- and, alas, the internal interfaces
&lt;br&gt;&amp;gt; are different anyway.
&lt;br&gt;&lt;br&gt;As I understand, Tiark is working with Phil on improved versions so that's
&lt;br&gt;another reason too.
&lt;br&gt;&lt;br&gt;Best,
&lt;br&gt;Ismael
&lt;br&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Adding-Bagwell%27s-Trie-to-the-collection%3A-benchmarks-tp26051021p26208584.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26196127</id>
	<title>Re: Polymorphic extension methods</title>
	<published>2009-11-04T05:17:29Z</published>
	<updated>2009-11-04T05:17:29Z</updated>
	<author>
		<name>Adam Warski-3</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;&amp;gt; When I was a &amp;quot;pure OO programmer&amp;quot;, I would have considered the &amp;nbsp;
&lt;br&gt;&amp;gt; pattern matching option evil ;) Now, I would try very hard to ensure &amp;nbsp;
&lt;br&gt;&amp;gt; that I only draw shapes (using your example) in one place. I would &amp;nbsp;
&lt;br&gt;&amp;gt; now have one place to maintain changes and one place where all the &amp;nbsp;
&lt;br&gt;&amp;gt; drawing logic exists. Localizing this logic is better for modularity &amp;nbsp;
&lt;br&gt;&amp;gt; than spreading it around in each Shape definition. That's a major &amp;nbsp;
&lt;br&gt;&amp;gt; plus, IMHO.
&lt;br&gt;That's why I think &amp;quot;polymorphic extension method&amp;quot; may convince even &amp;nbsp;
&lt;br&gt;pure OO programmers that a more functional approach doesn't have to be &amp;nbsp;
&lt;br&gt;evil ;). I agree that it's good to draw shapes only in one place, but &amp;nbsp;
&lt;br&gt;nothing stops you from writing methods for drawing different shapes in &amp;nbsp;
&lt;br&gt;one file. I was even writing that the extension methods would be a &amp;nbsp;
&lt;br&gt;good way to group methods with a similar responsibility in one place &amp;nbsp;
&lt;br&gt;(so group methods by what they do, not which class they belong to). If &amp;nbsp;
&lt;br&gt;you write a pattern matching method to draw the shapes, then if the &amp;nbsp;
&lt;br&gt;actual drawing takes more than 3 lines of code, you'll probably &amp;nbsp;
&lt;br&gt;extract two private methods (drawCircle &amp; drawSquare) anyway. &amp;nbsp;
&lt;br&gt;Otherwise, the method will quickly get very long.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Adam
&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Polymorphic-extension-methods-tp26144777p26196127.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26196058</id>
	<title>Re: Polymorphic extension methods</title>
	<published>2009-11-04T05:11:49Z</published>
	<updated>2009-11-04T05:11:49Z</updated>
	<author>
		<name>Adam Warski-3</name>
	</author>
	<content type="html">&lt;br&gt;&amp;gt; That is true; it is up to DataBinding[Transaction] to define implicit
&lt;br&gt;&amp;gt; DataBinding[AuthTransaction] and DataBinding[CaptureTransaction] in
&lt;br&gt;&amp;gt; scope and then have some means that can be used to recover the runtime
&lt;br&gt;&amp;gt; type - either a match on a sealed class or (in the case where your
&lt;br&gt;&amp;gt; entities are persisted by Hibernate and may be proxied) using a
&lt;br&gt;&amp;gt; Visitor.
&lt;br&gt;These two (matching/visitor) are exactly the two solutions that I &amp;nbsp;
&lt;br&gt;described in my post. They work, although if used repeatedly they &amp;nbsp;
&lt;br&gt;produce quite a lot of &amp;quot;noise&amp;quot; (boilerplate code; especially the &amp;nbsp;
&lt;br&gt;visitors).
&lt;br&gt;&lt;br&gt;&amp;gt; If you've discarded static type information along the way somewhere,
&lt;br&gt;&amp;gt; you've got to use a runtime technique to recover it. A polymorphic
&lt;br&gt;&amp;gt; method won't help you. If you have all the static type information you
&lt;br&gt;&amp;gt; need, then the correct implicit will be selected (well, so long as
&lt;br&gt;&amp;gt; DataBinding is invariant in its type parameter.)
&lt;br&gt;Sure. But you could also imagine having some syntactic sugar which &amp;nbsp;
&lt;br&gt;does that for you.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Adam
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Polymorphic-extension-methods-tp26144777p26196058.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26194606</id>
	<title>Re: Thoughts on scala.Zero, and algebraic structures  in the scala library</title>
	<published>2009-11-04T03:27:50Z</published>
	<updated>2009-11-04T03:27:50Z</updated>
	<author>
		<name>Matthew Willson-3</name>
	</author>
	<content type="html">&amp;gt; AFAIK, the whole purpose of his Zero was being able to generalize &amp;nbsp;
&lt;br&gt;&amp;gt; the implementation of certain parameterized classes.
&lt;br&gt;&lt;br&gt;Perhaps something like scala.Monoid could fill the same role? a &amp;nbsp;
&lt;br&gt;generalised zero is a whole lot more useful if there's a generalised &amp;nbsp;
&lt;br&gt;'plus' to use with it... although:
&lt;br&gt;&lt;br&gt;&amp;gt; The limited resources of the core team may be better applied to the &amp;nbsp;
&lt;br&gt;&amp;gt; compiler rather than the contentious task of 'haskell-ification' of &amp;nbsp;
&lt;br&gt;&amp;gt; the standard lib.
&lt;br&gt;&lt;br&gt;Certainly. I wasn't suggesting that the standard library necessarily &amp;nbsp;
&lt;br&gt;needs these things in it. Merely that, where the standard library DOES &amp;nbsp;
&lt;br&gt;choose to implement algebraic abstractions, it takes some care to get &amp;nbsp;
&lt;br&gt;them right, so they can be built upon cleanly by others.
&lt;br&gt;&lt;br&gt;In particular I wasn't suggesting borrowing wholesale from haskell - &amp;nbsp;
&lt;br&gt;haskell gets quite a few things wrong, eg its 'Num' class.
&lt;br&gt;&lt;br&gt;Cheers
&lt;br&gt;-Matt
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Thoughts-on-scala.Zero%2C-and-algebraic-structures-in-the-scala-library-tp26189906p26194606.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26194587</id>
	<title>Re: Thoughts on scala.Zero, and algebraic structures  in the scala library</title>
	<published>2009-11-04T03:26:03Z</published>
	<updated>2009-11-04T03:26:03Z</updated>
	<author>
		<name>_retronym</name>
	</author>
	<content type="html">For the record, I used the term &amp;quot;haskell-ification&amp;quot; in reference to Ben&amp;#39;s suggested direction, not in specific reference to the all-to-brief appearance of Zero, of which I was rather fond. :)&lt;br&gt;&lt;br&gt;-jason&lt;br&gt;
&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Nov 4, 2009 at 11:59 AM, Daniel Sobral &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26194587&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dcsobral@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
If you think Paul was in any way pursuing a &amp;quot;haskell-ification&amp;quot; of anything, I have some bottom land you might be interested in...&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;AFAIK, the whole purpose of his Zero was being able to generalize the implementation of certain parameterized classes.&lt;br&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Thoughts-on-scala.Zero%2C-and-algebraic-structures-in-the-scala-library-tp26189906p26194587.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26194322</id>
	<title>Re: Thoughts on scala.Zero, and algebraic structures  in the scala library</title>
	<published>2009-11-04T02:59:39Z</published>
	<updated>2009-11-04T02:59:39Z</updated>
	<author>
		<name>Daniel Sobral</name>
	</author>
	<content type="html">If you think Paul was in any way pursuing a &amp;quot;haskell-ification&amp;quot; of anything, I have some bottom land you might be interested in...&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;AFAIK, the whole purpose of his Zero was being able to generalize the implementation of certain parameterized classes.&lt;br&gt;

&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Nov 4, 2009 at 5:11 AM, Jason Zaugg &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26194322&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jzaugg@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;

The good news is that you can layer  these on top of Scala with the Scalaz library. Runar and Tony describe the relationship  here, in response to an earlier message from Ben: &lt;a href=&quot;http://groups.google.com/group/scalaz/browse_thread/thread/b686d161d9e5cd78/35ecff815569a2a1?hl=en&amp;amp;lnk=gst&amp;amp;q=implicit#35ecff815569a2a1&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://groups.google.com/group/scalaz/browse_thread/thread/b686d161d9e5cd78/35ecff815569a2a1?hl=en&amp;amp;lnk=gst&amp;amp;q=implicit#35ecff815569a2a1&lt;/a&gt;&lt;br&gt;


&lt;br&gt;The limited resources of the core team may be better applied to the compiler rather than the contentious task of &amp;#39;haskell-ification&amp;#39; of the standard lib.&lt;br&gt;&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;-jason&lt;/font&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;

&lt;div class=&quot;h5&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Nov 4, 2009 at 4:04 AM, Ben Hutchison &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26194322&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;brhutchison@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote: &lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex&quot;&gt;I&amp;#39;d like to see the Scala library design ruthlessly mine Haskell for&lt;br&gt;
its ideas and wisdom, especially with respect to algebraic structures.&lt;br&gt;
&lt;br&gt;
For an example of Haskell Wisdom, see the Typeclassopedia in:&lt;br&gt;
&lt;a href=&quot;http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf&lt;/a&gt;&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;
-Ben&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Daniel C. Sobral&lt;br&gt;&lt;br&gt;Veni, vidi, veterni.&lt;br&gt;
&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Thoughts-on-scala.Zero%2C-and-algebraic-structures-in-the-scala-library-tp26189906p26194322.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26193335</id>
	<title>Re: Thoughts on scala.Zero, and algebraic structures  in the scala library</title>
	<published>2009-11-04T01:39:08Z</published>
	<updated>2009-11-04T01:39:08Z</updated>
	<author>
		<name>Viktor Klang</name>
	</author>
	<content type="html">This is all fine and dandy, but how about Money?&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Nov 4, 2009 at 8:11 AM, Jason Zaugg &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26193335&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jzaugg@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
The good news is that you can layer  these on top of Scala with the Scalaz library. Runar and Tony describe the relationship  here, in response to an earlier message from Ben: &lt;a href=&quot;http://groups.google.com/group/scalaz/browse_thread/thread/b686d161d9e5cd78/35ecff815569a2a1?hl=en&amp;amp;lnk=gst&amp;amp;q=implicit#35ecff815569a2a1&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://groups.google.com/group/scalaz/browse_thread/thread/b686d161d9e5cd78/35ecff815569a2a1?hl=en&amp;amp;lnk=gst&amp;amp;q=implicit#35ecff815569a2a1&lt;/a&gt;&lt;br&gt;

&lt;br&gt;The limited resources of the core team may be better applied to the compiler rather than the contentious task of &amp;#39;haskell-ification&amp;#39; of the standard lib.&lt;br&gt;&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;-jason&lt;/font&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;
&lt;div class=&quot;h5&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Nov 4, 2009 at 4:04 AM, Ben Hutchison &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26193335&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;brhutchison@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote: &lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;I&amp;#39;d like to see the Scala library design ruthlessly mine Haskell for&lt;br&gt;
its ideas and wisdom, especially with respect to algebraic structures.&lt;br&gt;
&lt;br&gt;
For an example of Haskell Wisdom, see the Typeclassopedia in:&lt;br&gt;
&lt;a href=&quot;http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf&lt;/a&gt;&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;
-Ben&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Viktor Klang&lt;br&gt;| &amp;quot;A complex system that works is invariably &lt;br&gt;| found to have evolved from a simple system &lt;br&gt;| that worked.&amp;quot; - John Gall&lt;br&gt;&lt;br&gt;
Blog: &lt;a href=&quot;http://klangism.blogspot.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;klangism.blogspot.com&lt;/a&gt;&lt;br&gt;Twttr: viktorklang&lt;br&gt;Code: &lt;a href=&quot;http://github.com/viktorklang&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;github.com/viktorklang&lt;/a&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Thoughts-on-scala.Zero%2C-and-algebraic-structures-in-the-scala-library-tp26189906p26193335.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26191933</id>
	<title>Re: Thoughts on scala.Zero, and algebraic structures  in the scala library</title>
	<published>2009-11-03T23:11:37Z</published>
	<updated>2009-11-03T23:11:37Z</updated>
	<author>
		<name>_retronym</name>
	</author>
	<content type="html">The good news is that you can layer  these on top of Scala with the Scalaz library. Runar and Tony describe the relationship  here, in response to an earlier message from Ben: &lt;a href=&quot;http://groups.google.com/group/scalaz/browse_thread/thread/b686d161d9e5cd78/35ecff815569a2a1?hl=en&amp;amp;lnk=gst&amp;amp;q=implicit#35ecff815569a2a1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.google.com/group/scalaz/browse_thread/thread/b686d161d9e5cd78/35ecff815569a2a1?hl=en&amp;amp;lnk=gst&amp;amp;q=implicit#35ecff815569a2a1&lt;/a&gt;&lt;br&gt;
&lt;br&gt;The limited resources of the core team may be better applied to the compiler rather than the contentious task of &amp;#39;haskell-ification&amp;#39; of the standard lib.&lt;br&gt;&lt;br&gt;-jason&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Nov 4, 2009 at 4:04 AM, Ben Hutchison &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26191933&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;brhutchison@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote: &lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;I&amp;#39;d like to see the Scala library design ruthlessly mine Haskell for&lt;br&gt;
its ideas and wisdom, especially with respect to algebraic structures.&lt;br&gt;
&lt;br&gt;
For an example of Haskell Wisdom, see the Typeclassopedia in:&lt;br&gt;
&lt;a href=&quot;http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf&lt;/a&gt;&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;
-Ben&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Thoughts-on-scala.Zero%2C-and-algebraic-structures-in-the-scala-library-tp26189906p26191933.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26191068</id>
	<title>Re: Thoughts on scala.Zero, and algebraic structures in the scala library</title>
	<published>2009-11-03T21:02:15Z</published>
	<updated>2009-11-03T21:02:15Z</updated>
	<author>
		<name>Eastsun</name>
	</author>
	<content type="html">Scala 2.8 has some other Type relate to algebraic structures in my opinion, e.g. Fractional, Integral, Numeric ,(Addable ?)..
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Matthew Willson-3 wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;Spotted this in the recent scala additions:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://lampsvn.epfl.ch/trac/scala/changeset/19291/scala/trunk/src/library/scala/Zero.scala&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lampsvn.epfl.ch/trac/scala/changeset/19291/scala/trunk/src/library/scala/Zero.scala&lt;/a&gt;&lt;br&gt;&lt;br&gt;My thoughts:
&lt;br&gt;&lt;br&gt;- To call something a 'Zero' on a particular type, doesn't make much &amp;nbsp;
&lt;br&gt;sense (and isn't much use) without the context of a (typically &amp;nbsp;
&lt;br&gt;associative) binary operation on that set which it's a zero of
&lt;br&gt;- 'Identity' is a better term than 'zero' in this general context, in &amp;nbsp;
&lt;br&gt;particular it may be a left identity or a right identity or both
&lt;br&gt;- There's a name for sets with an identity and an associative binary &amp;nbsp;
&lt;br&gt;operation - a Monoid
&lt;br&gt;- Monoids would actually be pretty useful to have in the library, and &amp;nbsp;
&lt;br&gt;I think each of these implicit Zero instances should rather be a &amp;nbsp;
&lt;br&gt;Monoid instance, supplying the binary operation as well as its identity
&lt;br&gt;&lt;br&gt;Found an example of a monoid class (and implicit monoids) mentioned &amp;nbsp;
&lt;br&gt;here: &lt;a href=&quot;http://www.scala-lang.org/node/114&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.scala-lang.org/node/114&lt;/a&gt;&lt;br&gt;&lt;br&gt;So yeah, just wondering what the rationale here was, and more &amp;nbsp;
&lt;br&gt;generally, what the philosophy is about modelling algebraic structures &amp;nbsp;
&lt;br&gt;in the scala library.
&lt;br&gt;&lt;br&gt;Personally I'd love to see a really well-engineered set of classes for &amp;nbsp;
&lt;br&gt;algebraic structures made available, and it pains me a bit to see odds &amp;nbsp;
&lt;br&gt;and ends of mathematical structure done in the library in a rather ad- 
&lt;br&gt;hoc way which could be quite hard to make really consistent / coherent &amp;nbsp;
&lt;br&gt;further down the road once everyone's relying on them. This is what &amp;nbsp;
&lt;br&gt;happened with haskell, which is rather a sad tale. There are a few &amp;nbsp;
&lt;br&gt;alternative Preludes available for haskell now which 'do it right', &amp;nbsp;
&lt;br&gt;but at the cost of replacing the core of the standard library everyone &amp;nbsp;
&lt;br&gt;else is using.
&lt;br&gt;&lt;br&gt;Happy to help out here if anyone feels code would speak louder than &amp;nbsp;
&lt;br&gt;words :)
&lt;br&gt;&lt;br&gt;-Matt
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
&lt;div class=&quot;signature&quot;&gt;My scala solutions for &lt;a href=&quot;http://projecteuler.net/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Project Euler&lt;/a&gt;&amp;nbsp;problems: &lt;a href=&quot;http://eastsun.javaeye.com/category/34059&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Click here&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Thoughts-on-scala.Zero%2C-and-algebraic-structures-in-the-scala-library-tp26189906p26191068.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26190344</id>
	<title>Re: Thoughts on scala.Zero, and algebraic structures  in the scala library</title>
	<published>2009-11-03T19:04:44Z</published>
	<updated>2009-11-03T19:04:44Z</updated>
	<author>
		<name>Ben Hutchison-3</name>
	</author>
	<content type="html">On Wed, Nov 4, 2009 at 12:58 PM, Matthew Willson
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26190344&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;matthew.willson@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; So yeah, just wondering what the rationale here was, and more generally,
&lt;br&gt;&amp;gt; what the philosophy is about modelling algebraic structures in the scala
&lt;br&gt;&amp;gt; library.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Personally I'd love to see a really well-engineered set of classes for
&lt;br&gt;&amp;gt; algebraic structures made available, and it pains me a bit to see odds and
&lt;br&gt;&amp;gt; ends of mathematical structure done in the library in a rather ad-hoc way
&lt;br&gt;&amp;gt; which could be quite hard to make really consistent / coherent further down
&lt;br&gt;&amp;gt; the road once everyone's relying on them.
&lt;br&gt;&lt;br&gt;I agree with the above.
&lt;br&gt;&lt;br&gt;I'd like to see the Scala library design ruthlessly mine Haskell for
&lt;br&gt;its ideas and wisdom, especially with respect to algebraic structures.
&lt;br&gt;&lt;br&gt;For an example of Haskell Wisdom, see the Typeclassopedia in:
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/sitewiki/images/8/85/TMR-Issue13.pdf&lt;/a&gt;&lt;br&gt;&lt;br&gt;-Ben
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Thoughts-on-scala.Zero%2C-and-algebraic-structures-in-the-scala-library-tp26189906p26190344.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26190306</id>
	<title>Re: Thoughts on scala.Zero, and algebraic structures in the scala library</title>
	<published>2009-11-03T18:58:48Z</published>
	<updated>2009-11-03T18:58:48Z</updated>
	<author>
		<name>Paul Phillips-3</name>
	</author>
	<content type="html">&lt;br&gt;On Wed, Nov 04, 2009 at 01:58:05AM +0000, Matthew Willson wrote:
&lt;br&gt;&amp;gt; Spotted this in the recent scala additions:
&lt;br&gt;&lt;br&gt;You'll be happy to know that as is the rule more than the exception with 
&lt;br&gt;me lately, I'll be reverting it in the near future.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Paul Phillips &amp;nbsp; &amp;nbsp; &amp;nbsp;| These are the climbs that apply men's soles.
&lt;br&gt;Everyman &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | 
&lt;br&gt;Empiricist &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | 
&lt;br&gt;pp: i haul pills &amp;nbsp; |----------* &lt;a href=&quot;http://www.improving.org/paulp/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.improving.org/paulp/&lt;/a&gt;&amp;nbsp;*----------
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Thoughts-on-scala.Zero%2C-and-algebraic-structures-in-the-scala-library-tp26189906p26190306.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26189906</id>
	<title>Thoughts on scala.Zero, and algebraic structures in the scala library</title>
	<published>2009-11-03T17:58:05Z</published>
	<updated>2009-11-03T17:58:05Z</updated>
	<author>
		<name>Matthew Willson-3</name>
	</author>
	<content type="html">Spotted this in the recent scala additions:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://lampsvn.epfl.ch/trac/scala/changeset/19291/scala/trunk/src/library/scala/Zero.scala&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://lampsvn.epfl.ch/trac/scala/changeset/19291/scala/trunk/src/library/scala/Zero.scala&lt;/a&gt;&lt;br&gt;&lt;br&gt;My thoughts:
&lt;br&gt;&lt;br&gt;- To call something a 'Zero' on a particular type, doesn't make much &amp;nbsp;
&lt;br&gt;sense (and isn't much use) without the context of a (typically &amp;nbsp;
&lt;br&gt;associative) binary operation on that set which it's a zero of
&lt;br&gt;- 'Identity' is a better term than 'zero' in this general context, in &amp;nbsp;
&lt;br&gt;particular it may be a left identity or a right identity or both
&lt;br&gt;- There's a name for sets with an identity and an associative binary &amp;nbsp;
&lt;br&gt;operation - a Monoid
&lt;br&gt;- Monoids would actually be pretty useful to have in the library, and &amp;nbsp;
&lt;br&gt;I think each of these implicit Zero instances should rather be a &amp;nbsp;
&lt;br&gt;Monoid instance, supplying the binary operation as well as its identity
&lt;br&gt;&lt;br&gt;Found an example of a monoid class (and implicit monoids) mentioned &amp;nbsp;
&lt;br&gt;here: &lt;a href=&quot;http://www.scala-lang.org/node/114&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.scala-lang.org/node/114&lt;/a&gt;&lt;br&gt;&lt;br&gt;So yeah, just wondering what the rationale here was, and more &amp;nbsp;
&lt;br&gt;generally, what the philosophy is about modelling algebraic structures &amp;nbsp;
&lt;br&gt;in the scala library.
&lt;br&gt;&lt;br&gt;Personally I'd love to see a really well-engineered set of classes for &amp;nbsp;
&lt;br&gt;algebraic structures made available, and it pains me a bit to see odds &amp;nbsp;
&lt;br&gt;and ends of mathematical structure done in the library in a rather ad- 
&lt;br&gt;hoc way which could be quite hard to make really consistent / coherent &amp;nbsp;
&lt;br&gt;further down the road once everyone's relying on them. This is what &amp;nbsp;
&lt;br&gt;happened with haskell, which is rather a sad tale. There are a few &amp;nbsp;
&lt;br&gt;alternative Preludes available for haskell now which 'do it right', &amp;nbsp;
&lt;br&gt;but at the cost of replacing the core of the standard library everyone &amp;nbsp;
&lt;br&gt;else is using.
&lt;br&gt;&lt;br&gt;Happy to help out here if anyone feels code would speak louder than &amp;nbsp;
&lt;br&gt;words :)
&lt;br&gt;&lt;br&gt;-Matt
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Thoughts-on-scala.Zero%2C-and-algebraic-structures-in-the-scala-library-tp26189906p26189906.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26182892</id>
	<title>Re: Polymorphic extension methods</title>
	<published>2009-11-03T09:01:07Z</published>
	<updated>2009-11-03T09:01:07Z</updated>
	<author>
		<name>Dean Wampler-2</name>
	</author>
	<content type="html">When I was a &amp;quot;pure OO programmer&amp;quot;, I would have considered the pattern matching option evil ;) Now, I would try very hard to ensure that I only draw shapes (using your example) in one place. I would now have one place to maintain changes and one place where all the drawing logic exists. Localizing this logic is better for modularity than spreading it around in each Shape definition. That&amp;#39;s a major plus, IMHO.&lt;div&gt;
&lt;br&gt;&lt;/div&gt;&lt;div&gt;My point is that you should first try to avoid needing the extension methods, as they add some complexity and increase the testing and maintenance burden. If you can&amp;#39;t avoid extension methods, then one of the discussed solutions should be fine.&lt;/div&gt;
&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;dean&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Sat, Oct 31, 2009 at 12:25 PM, Adam Warski &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26182892&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;adam@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;
Hello,&lt;br&gt;
&lt;br&gt;
I&amp;#39;ve been wondering recently about if and how to implement, as I call them, &amp;quot;polymorphic&amp;quot; extension methods.&lt;br&gt;
In Scala, extension methods are normally implemented using implicit conversions. However there&amp;#39;s a major limitation - implicits don&amp;#39;s support polymorphism.&lt;br&gt;
&lt;br&gt;
My use case is following: I have some data-only objects, lets say they represent shapes. They may either use inheritance (e.g. Square extends Shape, Circle extends Shape), implement common interfaces (Square implements Shape, Circle implements Shape), or traits. They are manipulated and persisted (for example mapped with Hibernate to a DB) in a backend system.&lt;br&gt;

&lt;br&gt;
Now I want to display the shapes on different frontend systems (using Swing, a web app, etc). So for each of the shapes I need an implementation of a draw() method (quite obviously, a square is drawn differently than a circle ;) ). I don&amp;#39;t want to store frontend-specific code in the backend (so that rules out simply putting the method in the class), and I want each frontend to have a different implementation (in Swing you draw differently than in a web app).&lt;br&gt;

&lt;br&gt;
I think the best way to do this in Scala now is to use pattern matching, so in each of the frontends I would have a draw(Shape) method like this:&lt;br&gt;
def draw(shape: Shape) = shape match {&lt;br&gt;
  case s: Square =&amp;gt; drawSquare(s)&lt;br&gt;
  case c: Circle =&amp;gt; drawCircle(c)&lt;br&gt;
  case ...&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
def drawSquare(s: Square) = ...&lt;br&gt;
def drawCircle(s: Square) = ...&lt;br&gt;
&lt;br&gt;
in some (probably artificially created) wrapper class &amp;quot;Drawer&amp;quot; or sth like this.&lt;br&gt;
&lt;br&gt;
Having to write the pattern matching, and to create a wrapper class to hold those draw methods isn&amp;#39;t quite as nice as just having the methods in the classes. But why not do that? If we could extend a class with a method (also an abstract method!) than the example above would just be:&lt;br&gt;

extend class Shape with { def draw }&lt;br&gt;
extend class Square with { def draw = ... }&lt;br&gt;
extend class Circle with { def draw = ... }&lt;br&gt;
&lt;br&gt;
The extend class ... with { } syntax is completely from the top of my head, and probably a better one can be devised. But I hope that the idea is clear :)&lt;br&gt;
&lt;br&gt;
That way, it would be possible to have simple data classes, group different functionalities in the extension methods and still have OO benefits. Also it could be a good compromise between the supporters of anemic models and DDD (rich models). And it would prevent bloating classes with lots of methods for all kinds of uses that an object may have.&lt;br&gt;

&lt;br&gt;
How to implement this? To make it simple for the beginning, let&amp;#39;s say that we require that only sealed case classes can use extension methods. The compiler (or rather - an appropriate compiler plug-in) would first collect information on which classes define extension methods. Having that information, we can check that if abstract extension methods are used, every subclass provides an implementation (because we require only sealed classes, we know all subclasses). Then, the methods and their usages may be re-written to the wrapper-class+case-matching+methods-per-implementation form as above.&lt;br&gt;

&lt;br&gt;
What do you think? Do you see any problems/holes/etc? :) Maybe it has been discussed before (although my search of Scala&amp;#39;s mailing lists didn&amp;#39;t reveal anything)?&lt;br&gt;&lt;font color=&quot;#888888&quot;&gt;
&lt;br&gt;
Adam&lt;br&gt;
&lt;/font&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;br clear=&quot;all&quot;&gt;&lt;br&gt;-- &lt;br&gt;Dean Wampler&lt;br&gt;coauthor of &amp;quot;Programming Scala&amp;quot; (O&amp;#39;Reilly)&lt;br&gt;-  &lt;a href=&quot;http://programmingscala.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://programmingscala.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;twitter: @deanwampler, @chicagoscala&lt;br&gt;
Chicago-Area Scala Enthusiasts (CASE):&lt;br&gt;-  &lt;a href=&quot;http://groups.google.com/group/chicagoscala&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groups.google.com/group/chicagoscala&lt;/a&gt;&lt;br&gt;-  &lt;a href=&quot;http://www.meetup.com/chicagoscala/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.meetup.com/chicagoscala/&lt;/a&gt; (Meetings)&lt;br&gt;
&lt;a href=&quot;http://www.linkedin.com/in/deanwampler&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.linkedin.com/in/deanwampler&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.polyglotprogramming.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.polyglotprogramming.com&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://aquarium.rubyforge.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://aquarium.rubyforge.org&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://www.contract4j.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.contract4j.org&lt;/a&gt;&lt;br&gt;
&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Polymorphic-extension-methods-tp26144777p26182892.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26182293</id>
	<title>Re: Polymorphic extension methods</title>
	<published>2009-11-03T08:24:30Z</published>
	<updated>2009-11-03T08:24:30Z</updated>
	<author>
		<name>nuttycom</name>
	</author>
	<content type="html">On Tue, Nov 3, 2009 at 8:45 AM, Adam Warski &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26182293&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;adam@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I use a technique that uses an implicit method (to supply the
&lt;br&gt;&amp;gt;&amp;gt; conversion) with an implicit parameter (which supplies the rendering
&lt;br&gt;&amp;gt;&amp;gt; logic) to achieve what (I think) you're talking about here. I did it
&lt;br&gt;&amp;gt;&amp;gt; in the context of Lift bindings, but I think that the technique is
&lt;br&gt;&amp;gt;&amp;gt; generally applicable.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; But if I understand correctly it doesn't support polymorphic definitions of
&lt;br&gt;&amp;gt; bind().
&lt;br&gt;&amp;gt; If you wanted to have for example different implementations for bind() for
&lt;br&gt;&amp;gt; AuthTransaction and CaptureTransaction, then even if you implemented
&lt;br&gt;&amp;gt; DataBinding[AuthTransaction] and DataBinding[CaptureTransaction], still the
&lt;br&gt;&amp;gt; DataBinding[Transaction] would be used (when doing
&lt;br&gt;&amp;gt; order.transactions.flatMap(_.bind(txnTemplate)).toSeq), as statically that's
&lt;br&gt;&amp;gt; what the compiler knows about the type, and so applies the appropriate
&lt;br&gt;&amp;gt; implicits it can find.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Adam
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;That is true; it is up to DataBinding[Transaction] to define implicit
&lt;br&gt;DataBinding[AuthTransaction] and DataBinding[CaptureTransaction] in
&lt;br&gt;scope and then have some means that can be used to recover the runtime
&lt;br&gt;type - either a match on a sealed class or (in the case where your
&lt;br&gt;entities are persisted by Hibernate and may be proxied) using a
&lt;br&gt;Visitor.
&lt;br&gt;&lt;br&gt;If you've discarded static type information along the way somewhere,
&lt;br&gt;you've got to use a runtime technique to recover it. A polymorphic
&lt;br&gt;method won't help you. If you have all the static type information you
&lt;br&gt;need, then the correct implicit will be selected (well, so long as
&lt;br&gt;DataBinding is invariant in its type parameter.)
&lt;br&gt;&lt;br&gt;Kris
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Polymorphic-extension-methods-tp26144777p26182293.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26181627</id>
	<title>Re: Polymorphic extension methods</title>
	<published>2009-11-03T07:45:02Z</published>
	<updated>2009-11-03T07:45:02Z</updated>
	<author>
		<name>Adam Warski-3</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I use a technique that uses an implicit method (to supply the
&lt;br&gt;&amp;gt; conversion) with an implicit parameter (which supplies the rendering
&lt;br&gt;&amp;gt; logic) to achieve what (I think) you're talking about here. I did it
&lt;br&gt;&amp;gt; in the context of Lift bindings, but I think that the technique is
&lt;br&gt;&amp;gt; generally applicable.
&lt;br&gt;&lt;br&gt;But if I understand correctly it doesn't support polymorphic &amp;nbsp;
&lt;br&gt;definitions of bind().
&lt;br&gt;If you wanted to have for example different implementations for bind() &amp;nbsp;
&lt;br&gt;for AuthTransaction and CaptureTransaction, then even if you &amp;nbsp;
&lt;br&gt;implemented DataBinding[AuthTransaction] and DataBinding 
&lt;br&gt;[CaptureTransaction], still the DataBinding[Transaction] would be used &amp;nbsp;
&lt;br&gt;(when doing order.transactions.flatMap(_.bind(txnTemplate)).toSeq), as &amp;nbsp;
&lt;br&gt;statically that's what the compiler knows about the type, and so &amp;nbsp;
&lt;br&gt;applies the appropriate implicits it can find.
&lt;br&gt;&lt;br&gt;Adam
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Polymorphic-extension-methods-tp26144777p26181627.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26173835</id>
	<title>Re: Polymorphic extension methods</title>
	<published>2009-11-02T17:51:22Z</published>
	<updated>2009-11-02T17:51:22Z</updated>
	<author>
		<name>nuttycom</name>
	</author>
	<content type="html">On Sat, Oct 31, 2009 at 12:25 PM, Adam Warski &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26173835&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;adam@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hello,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I've been wondering recently about if and how to implement, as I call them,
&lt;br&gt;&amp;gt; &amp;quot;polymorphic&amp;quot; extension methods.
&lt;br&gt;&amp;gt; In Scala, extension methods are normally implemented using implicit
&lt;br&gt;&amp;gt; conversions. However there's a major limitation - implicits don's support
&lt;br&gt;&amp;gt; polymorphism.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; My use case is following: I have some data-only objects, lets say they
&lt;br&gt;&amp;gt; represent shapes. They may either use inheritance (e.g. Square extends
&lt;br&gt;&amp;gt; Shape, Circle extends Shape), implement common interfaces (Square implements
&lt;br&gt;&amp;gt; Shape, Circle implements Shape), or traits. They are manipulated and
&lt;br&gt;&amp;gt; persisted (for example mapped with Hibernate to a DB) in a backend system.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Now I want to display the shapes on different frontend systems (using Swing,
&lt;br&gt;&amp;gt; a web app, etc). So for each of the shapes I need an implementation of a
&lt;br&gt;&amp;gt; draw() method (quite obviously, a square is drawn differently than a circle
&lt;br&gt;&amp;gt; ;) ). I don't want to store frontend-specific code in the backend (so that
&lt;br&gt;&amp;gt; rules out simply putting the method in the class), and I want each frontend
&lt;br&gt;&amp;gt; to have a different implementation (in Swing you draw differently than in a
&lt;br&gt;&amp;gt; web app).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I think the best way to do this in Scala now is to use pattern matching, so
&lt;br&gt;&amp;gt; in each of the frontends I would have a draw(Shape) method like this:
&lt;br&gt;&amp;gt; def draw(shape: Shape) = shape match {
&lt;br&gt;&amp;gt;  case s: Square =&amp;gt; drawSquare(s)
&lt;br&gt;&amp;gt;  case c: Circle =&amp;gt; drawCircle(c)
&lt;br&gt;&amp;gt;  case ...
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; def drawSquare(s: Square) = ...
&lt;br&gt;&amp;gt; def drawCircle(s: Square) = ...
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; in some (probably artificially created) wrapper class &amp;quot;Drawer&amp;quot; or sth like
&lt;br&gt;&amp;gt; this.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Having to write the pattern matching, and to create a wrapper class to hold
&lt;br&gt;&amp;gt; those draw methods isn't quite as nice as just having the methods in the
&lt;br&gt;&amp;gt; classes. But why not do that? If we could extend a class with a method (also
&lt;br&gt;&amp;gt; an abstract method!) than the example above would just be:
&lt;br&gt;&amp;gt; extend class Shape with { def draw }
&lt;br&gt;&amp;gt; extend class Square with { def draw = ... }
&lt;br&gt;&amp;gt; extend class Circle with { def draw = ... }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The extend class ... with { } syntax is completely from the top of my head,
&lt;br&gt;&amp;gt; and probably a better one can be devised. But I hope that the idea is clear
&lt;br&gt;&amp;gt; :)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; That way, it would be possible to have simple data classes, group different
&lt;br&gt;&amp;gt; functionalities in the extension methods and still have OO benefits. Also it
&lt;br&gt;&amp;gt; could be a good compromise between the supporters of anemic models and DDD
&lt;br&gt;&amp;gt; (rich models). And it would prevent bloating classes with lots of methods
&lt;br&gt;&amp;gt; for all kinds of uses that an object may have.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; How to implement this? To make it simple for the beginning, let's say that
&lt;br&gt;&amp;gt; we require that only sealed case classes can use extension methods. The
&lt;br&gt;&amp;gt; compiler (or rather - an appropriate compiler plug-in) would first collect
&lt;br&gt;&amp;gt; information on which classes define extension methods. Having that
&lt;br&gt;&amp;gt; information, we can check that if abstract extension methods are used, every
&lt;br&gt;&amp;gt; subclass provides an implementation (because we require only sealed classes,
&lt;br&gt;&amp;gt; we know all subclasses). Then, the methods and their usages may be
&lt;br&gt;&amp;gt; re-written to the wrapper-class+case-matching+methods-per-implementation
&lt;br&gt;&amp;gt; form as above.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What do you think? Do you see any problems/holes/etc? :) Maybe it has been
&lt;br&gt;&amp;gt; discussed before (although my search of Scala's mailing lists didn't reveal
&lt;br&gt;&amp;gt; anything)?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Adam
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;I use a technique that uses an implicit method (to supply the
&lt;br&gt;conversion) with an implicit parameter (which supplies the rendering
&lt;br&gt;logic) to achieve what (I think) you're talking about here. I did it
&lt;br&gt;in the context of Lift bindings, but I think that the technique is
&lt;br&gt;generally applicable.
&lt;br&gt;&lt;br&gt;Blogged about it here:
&lt;br&gt;&lt;a href=&quot;http://logji.blogspot.com/2009/09/composable-bindings-in-lift.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://logji.blogspot.com/2009/09/composable-bindings-in-lift.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;Kris
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Polymorphic-extension-methods-tp26144777p26173835.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26164552</id>
	<title>Re: Re: Polymorphic extension methods</title>
	<published>2009-11-02T06:19:55Z</published>
	<updated>2009-11-02T06:19:55Z</updated>
	<author>
		<name>Randall Schulz</name>
	</author>
	<content type="html">On Saturday October 31 2009, Jesper Nordenberg wrote:
&lt;br&gt;&amp;gt; See:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.scala-lang.org/docu/files/IC_TECH_REPORT_200433.pdf&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.scala-lang.org/docu/files/IC_TECH_REPORT_200433.pdf&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; for a solution to exactly this problem (it's called the expression
&lt;br&gt;&amp;gt; problem).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; /Jesper Nordenberg
&lt;br&gt;&lt;br&gt;If you're willing to sacrifice static type safety within for the 
&lt;br&gt;relevant portion of your program that, Kiama's [1] Rewriter module is a 
&lt;br&gt;very elegant solution to this class of problems. It completely 
&lt;br&gt;separates reusable traversal control combinators (which it supplies in 
&lt;br&gt;abundance) from the logic of your program specific to the types it 
&lt;br&gt;operates upon. The only real restriction is that it is limited to case 
&lt;br&gt;classes (more precisely, subclasses of Product).
&lt;br&gt;&lt;br&gt;&lt;br&gt;[1] &amp;lt;&lt;a href=&quot;http://code.google.com/p/kiama/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://code.google.com/p/kiama/&lt;/a&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;Randall Schulz
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Polymorphic-extension-methods-tp26144777p26164552.html" />
</entry>

</feed>
