<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel about="http://permalink.gmane.org/gmane.comp.lang.scala">
    <title>gmane.comp.lang.scala</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13776"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13774"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13773"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13772"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13771"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13770"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13769"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13768"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13767"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13766"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13765"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13764"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13763"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13762"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13761"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13760"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13759"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13758"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13757"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.scala/13756"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13776">
    <title>xsd processor in scala?</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13776</link>
    <description>Scalads and lasses,

Has anyone written an xsd processor (to check conformance of documents,
generate documents, etc) in scala? Last night i did the most basic qa on
jaxb you could imagine -- apply jaxb to the schema for schema . As you can
guess, it failed. This would be like gcc failing to build gcc -- not
acceptable. i'm hoping there's a higher quality offering somewhere in the
functional arsenal.

(Interestingly, the W3C-blessed XMLSchema.xsd doesn't conform to itself! At
least you can fix this, though.)

Best wishes,

--greg

</description>
    <dc:creator>Meredith Gregory</dc:creator>
    <dc:date>2008-10-07T16:46:51</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13774">
    <title>Re: collection conversion again...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13774</link>
    <description>Also, you can do "import scala.collections.mutable.jcl.Conversions._"
in your file to scope a bunch of implicit conversions that
automatically convert between Java and Scala collections.

Sean

On Tue, Oct 7, 2008 at 6:15 AM, Erik Engbrecht &lt;erik.engbrecht&lt; at &gt;gmail.com&gt; wrote:

</description>
    <dc:creator>Sean McDirmid</dc:creator>
    <dc:date>2008-10-07T01:53:32</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13773">
    <title>Re: ambiguous implicit conversion error</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13773</link>
    <description>
Mea culpa.  I usually run what I post through the interpreter first
to make sure I am posting the right code, but this time I took
a short cut and just typed it in (incorrectly, as you point out)
rather than pasting what I ran through the interpreter.  One more
experience to support the practice of full unit testing.


In this case both Int and String are final classes, so I think
specifying [I&lt;:Int] should be the same as requiring an Int as in
the first approach.  I think the approach should work even for
non-final classes, since the type parameter to Option is covariant,
but I haven't tried it, so there may be some issue I am not aware
of - or I may be getting my co and contra confused.

I thought it was interesting that the first approach led to compiler
error messages and the second did not, so the error is apparently
not due solely to type erasure.

--
Jim


</description>
    <dc:creator>Jim McBeath</dc:creator>
    <dc:date>2008-10-06T23:20:38</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13772">
    <title>Re: collection conversion again...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13772</link>
    <description>What industry do you work in?

"...the existence of this documentation seems inevitable" ???

Sorry...I couldn't help it...

There's the scala.collections.mutable.jcl (or something like that) for
wrapping Java collections to make them look like mutable Scala collections.
I'm not aware of anything for the other way around, but it's been a while
since I looked.

On Mon, Oct 6, 2008 at 6:09 PM, Meredith Gregory
&lt;lgreg.meredith&lt; at &gt;gmail.com&gt;wrote:




</description>
    <dc:creator>Erik Engbrecht</dc:creator>
    <dc:date>2008-10-06T22:15:28</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13771">
    <title>collection conversion again...</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13771</link>
    <description>Scalads and lasses,

Where is the documentation for the conversion idioms for the usual java
collections collected? i've been grepping/searching/... for an hour now and
cannot find a nicely collected set of documents describing the various ways
to do this. Surely, surely, the vast majority of collections originate in
Java and move toward Scala perhaps finally make it back to Java. So, the
existence of this documentation seems inevitable.

Best wishes,

--greg

</description>
    <dc:creator>Meredith Gregory</dc:creator>
    <dc:date>2008-10-06T22:09:13</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13770">
    <title>Re: ambiguous implicit conversion error</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13770</link>
    <description>
FYI that's not what was originally posted, and those don't do what they might appear to 
do.  The original versions had no type parameters:

  implicit def optIntToString(n:Option[Int]) = n.get.toString
  implicit def optStringToString(s:Option[String]) = s.get.toString

The two methods up top each has a type parameter, the first calling it "Int", the second 
"String", and in reality they're the same method.  I found a while ago that it's wise to 
always explicitly state return types in implicits, and in this case that would have shown 
the error because the type parameter String shadows java.lang.String.

scala&gt; implicit def optStringToString[String](s:Option[String]): String = s.get.toString
&lt;console&gt;:4: error: type mismatch;
 found   : java.lang.String
 required: String
       implicit def optStringToString[String](s:Option[String]): String = s.get.toString


The method parameter lists still have the same erasure, but now the methods are 
polymorphic with different type bounds.

</description>
    <dc:creator>Paul Phillips</dc:creator>
    <dc:date>2008-10-06T16:26:49</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13769">
    <title>Re: ambiguous implicit conversion error</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13769</link>
    <description>
Based on this suggestion, I tried changing my implicits from this (as
originally posted):

  implicit def optIntToString[Int](n:Option[Int]) = n.get.toString
  implicit def optStringToString[String](s:Option[String]) = s.get.toString

to this:

  implicit def optIntToString[I&lt;:Int](n:Option[I]) = n.get.toString
  implicit def optStringToString[S&lt;:String](s:Option[S]) = s.get.toString

With this slightly modified definition, the assignment that used to fail:

  val s2:String = Some(123)

now works, although the erasures are still identical.

--
Jim

</description>
    <dc:creator>Jim McBeath</dc:creator>
    <dc:date>2008-10-06T00:56:11</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13768">
    <title>Re: ambiguous implicit conversion error</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13768</link>
    <description>On Sun, 05 Oct 2008 22:31:11 +0200, David MacIver  
&lt;david.maciver&lt; at &gt;gmail.com&gt; wrote:


There seems to be some issues with implicits and higher-ordered types
used together. I while ago, I reported
http://lampsvn.epfl.ch/trac/scala/ticket/298, which still isn't solved.
The issues are not identical, but they're probably related.

   / Rickard


</description>
    <dc:creator>Rickard Nilsson</dc:creator>
    <dc:date>2008-10-05T21:48:24</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13767">
    <title>Re: ambiguous implicit conversion error</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13767</link>
    <description>
The parameter lists for the two implicit methods have the same erasure.  I feel like this is the root of the problem, 
but I can't explain it satisfactorily because type inference should take place before erasure.  Since the error 
reports the type of Some(123) as Some[?A] it seems safe it's not Some[Int], which is what it is in the one which 
works.  Notice it works if we approach the implicit differently:

  scala&gt; val s2 = Some(123) + "b"
  s2: java.lang.String = 123b

If you parameterize the implicit it works as you want:

  scala&gt; implicit def optToString[T](s: Option[T]): String = s.get.toString
  optToString: [T](Option[T])String
  scala&gt; val s2: String = Some(123)
  s2: String = 123

I also wonder about the later message:


I don't think scala will be seeing that required "String with Int" anytime soon.

</description>
    <dc:creator>Paul Phillips</dc:creator>
    <dc:date>2008-10-05T20:50:48</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13766">
    <title>Re: ambiguous implicit conversion error</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13766</link>
    <description>
If you add a type parameter to Some then it works. i.e. val s2 :
String = Some[Int](123) so I think what's happening here is that it's
seeing that you have an Option[T], determining that this isn't a
String and immediately trying to force an implicit conversion before
attempting to resolve the type parameter of Option and discovering
that it doesn't have enough information at that point.

It looks like a bug to me, but I suspect it might be a difficult one
to resolve (just guessing. I know very little about the type
inferencer). Still worth filing.

</description>
    <dc:creator>David MacIver</dc:creator>
    <dc:date>2008-10-05T20:31:11</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13765">
    <title>Re: ambiguous implicit conversion error</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13765</link>
    <description>Jorge,

Yes, I know.  The body of the implicit conversion is irrelevant to
the example, I was trying to cut the code down to the minimum that
would exhibit the issue.

--
Jim

On Sun, Oct 05, 2008 at 12:28:11PM -0700, Jorge Ortiz wrote:

</description>
    <dc:creator>Jim McBeath</dc:creator>
    <dc:date>2008-10-05T20:21:35</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13764">
    <title>Re: ambiguous implicit conversion error</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13764</link>
    <description>I don't know about your particular error, but using an implicit conversion
that calls "get" on an Option defeats the whole point of using Options.

It works fine for Some, but when you have a None the implicit conversion
will just throw an exception. This quickly becomes as bad as or worse than
NullPointerExceptions.

--j

On Sun, Oct 5, 2008 at 12:11 PM, Jim McBeath &lt;scala&lt; at &gt;j.jimmc.org&gt; wrote:

</description>
    <dc:creator>Jorge Ortiz</dc:creator>
    <dc:date>2008-10-05T19:28:11</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13763">
    <title>ambiguous implicit conversion error</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13763</link>
    <description>//Set up two implicit conversions to Option[something]
implicit def optIntToString(n:Option[Int]) = n.get.toString
implicit def optStringToString(s:Option[String]) = s.get.toString

val s1:String = { val opt = Some(123); opt }    //OK, returns "123"
val s2:String = Some(123)       //compiler error, ambiguous implicit conversion

I get this error for the s2 assignment:
    error: type mismatch;
     found   : Some[?A]
     required: String
    Note that implicit conversions are not applicable because they are ambiguous:
     both method optStringToString in object $iw of type (Option[String])java.lang.String
     and method optIntToString in object $iw of type (Option[Int])java.lang.String
     are possible conversion functions from Some[?A] to String
    &lt;console&gt;:6: error: type mismatch;
     found   : Int(123)
     required: String with Int
   val s2:String = Some(123)

Why is the compiler able to figure out how to convert to s1 but not to s2?
It seems to me that it has the same information available in b</description>
    <dc:creator>Jim McBeath</dc:creator>
    <dc:date>2008-10-05T19:11:04</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13762">
    <title>Re: Re: A suggestion to optimize the for loops</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13762</link>
    <description>

Ok, after more thought, I guess filter would count as a leaf operation,
because of the lazy projection.

Anyway, in that case, I _did_ execute the leaf a 100 million times (10000 *
10000), in each benchmark.


</description>
    <dc:creator>Harshad</dc:creator>
    <dc:date>2008-10-05T18:49:50</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13761">
    <title>Re: Re: A suggestion to optimize the for loops</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13761</link>
    <description>
And in order to do something shocking and back an opinion with actual
evidence, here's some code:

trait IntAction{
  def apply(i : Int) : Unit;
}

object IntLoop{
  def times(size : Int, action : IntAction) {
    var i = 0;
    while(i &lt; size){
      action(i);
      i += 1;
    }
  }
}

object LoopBenchmark extends scalax.testing.SizedBenchmark{
  var sum = 0;

  override val sizes = Array.range(0, 22).map(i =&gt; 1 &lt;&lt; i)

  new Benchmark[Int]("while"){
    def data(size : Int) = size;
    def test(size : Int) = {
      var i = 0;
      while (i &lt; size){
        i += 1;
        sum += i;
      }
    }
  }

  new Benchmark[Int]("IntLoop"){
    def data(size : Int) = size;
    def test(size : Int) = {
      IntLoop.times(size, new IntAction(){
        def apply(i : Int) { sum += i; }
      })
    }
  }
}

And here are some numbers for running it on the Java 6 server VM (the
client VM gives similar results):

scala&gt; LoopBenchmark.main(null)
Size, while, IntLoop
1, 0.9288, 1.4625
2, 1.4897, 2.1465
4, 1.8854, 2.6</description>
    <dc:creator>David MacIver</dc:creator>
    <dc:date>2008-10-05T15:06:06</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13760">
    <title>Re: Re: A suggestion to optimize the for loops</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13760</link>
    <description>Impressive!

Thanx for the info.


Respectfully yours,

Christos.

On Sun, Oct 5, 2008 at 4:58 PM, David Pollak
&lt;feeder.of.the.bears&lt; at &gt;gmail.com&gt;wrote:




</description>
    <dc:creator>Christos KK Loverdos</dc:creator>
    <dc:date>2008-10-05T14:43:24</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13759">
    <title>Re: Re: A suggestion to optimize the for loops</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13759</link>
    <description>

It sound too general a statement to me. It only makes sense, when
benchmarking leaf operations, and trying to find the asymptotic upper-bound
of the operation. It doesn't make sense when,
* trying to measure performances of non-leaf operations, and hence,
* trying to compare the constant time factor in the operation.



Yes, I didn't do a comprehensive benchmark. That said, we should see if the
optimisation helps on any given JVM, regardless if different JVMs don't
compare well to each other.

My JVM is:
(Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_03) on a x86 (Core 2 Duo)


Yes, and that resulted in:
https://lampsvn.epfl.ch/trac/scala/ticket/1402


It is a good point. IMHO, possible solutions could be either
* the (new) semantic meaning of for could be documented, or,
* the semantic meaning of filter could be clarified (and needs to be adhered
to)

Either way, it means a semantic change and perhaps only doable in a major
version bump.


</description>
    <dc:creator>Harshad</dc:creator>
    <dc:date>2008-10-05T14:42:41</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13758">
    <title>Re: Re: A suggestion to optimize the for loops</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13758</link>
    <description>On Sun, Oct 5, 2008 at 3:02 PM, David Pollak
&lt;feeder.of.the.bears&lt; at &gt;gmail.com&gt; wrote:

And not improving something because making it better for non-broken
code might break broken code is worse.


Sorry, I don't know how to respond to an unbacked assertion which
flies in the face of observed facts. Could you rephrase that as a
useful sentence?

</description>
    <dc:creator>David MacIver</dc:creator>
    <dc:date>2008-10-05T14:25:57</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13757">
    <title>Re: Re: A suggestion to optimize the for loops</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13757</link>
    <description>I don't see why we'd want to shut off inheritance, just put them in a
separate tree and don't give them anyref by default. I guess one model
that we could follow would be .NET with its separate inheritance tree
for delegates, though delegates seem to be objects there.

Sean

On Sun, Oct 5, 2008 at 10:22 PM, David MacIver &lt;david.maciver&lt; at &gt;gmail.com&gt; wrote:

</description>
    <dc:creator>Sean McDirmid</dc:creator>
    <dc:date>2008-10-05T14:27:46</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13756">
    <title>Re: Re: A suggestion to optimize the for loops</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13756</link>
    <description>
I don't think that would be particularly beneficial. For example a lot
of things extend Function, so many functions legitimately are AnyRefs.
The only functions one should really be aggressively optimised are
ones created locally as lambdas.

</description>
    <dc:creator>David MacIver</dc:creator>
    <dc:date>2008-10-05T14:22:35</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.scala/13755">
    <title>Re: Re: A suggestion to optimize the for loops</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.scala/13755</link>
    <description>======= On Sunday 05 October 2008, David Pollak wrote: =======
...

David, 

It is off topic, but about you and performance :-) Probably my memory is 
wrong, but AFAIR there was a mailing list thread in which you resolved some 
problem wrt performance of Scala combinators. Will you be so kind to point 
me that discussion? The thing is, I use the combinators for simple text 
templating, and they are bottleneck in all request-processing-response 
chain in my httpd service (say, 900 req/seq with simple template vs 7000 
req/seq with direct the ~same stream writing).


Andrew

</description>
    <dc:creator>Andrew Gaydenko</dc:creator>
    <dc:date>2008-10-05T14:20:22</dc:date>
  </item>
  <textinput about="http://search.gmane.org/?group=$group=gmane.comp.lang.scala">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lang.scala</link>
  </textinput>
</rdf:RDF>
