Erik Bruchez | 24 May 2013 20:42
Picon

For comprehension returning unexpected type with unused assignation

All:

With 2.10.1:

scala> for ((k, v) <- Map("a" -> "b")) yield v -> k
res0: scala.collection.immutable.Map[String,String] = Map(b -> a)

scala> for ((k, v) <- Map("a" -> "b"); a = k.length) yield v -> k
res1: scala.collection.immutable.Map[String,String] = Map(b -> a)

But:

scala> for ((k, v) <- Map("a" -> "b"); a = k.length; b = v.length) yield v -> k
res2: scala.collection.immutable.Iterable[(String, String)] = List((b,a))

Am I missing something, or bug?

-Erik

--

-- 
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe@...
For more options, visit https://groups.google.com/groups/opt_out.

Som Snytt | 24 May 2013 03:13
Picon

-Xexperimental exhaustive check for virtpatmat


"Is the -Xexperimental exhaustive check for virtpatmat known to be experimentally non-deterministic?"

"I dunno, let me google.  Yes, here it is."

https://issues.scala-lang.org/browse/SI-7020

"OK, that was easy.  That google is pretty nifty.  I found this because I added stderr output to partest logs a few weeks ago, and these were the only tests that couldn't pass, no matter how many times I ran --update-check.  I'm kind of glad the kitteh is not sitting in a loop doing --update-check until the tests pass.  Which sounded like a good idea at the time."

"How about implementing the line filter to remove it from the log file?  There's a ticket for that."

https://issues.scala-lang.org/browse/SI-7198

"OK, I'll do that.  The stderr > log change didn't make it into the last Par-Test PR, but there is already a ticket for that, too."

https://issues.scala-lang.org/browse/SI-7003

"Sounds good, but don't do anything that makes it noisy again.  And why do you call it Par-Test with a hyphen?"

"It's like Spider-Man.  'Catches bugs just like flies.'  And par like in golf."

"Really?  I thought it was par like parallel."

"No, then you'd have to pronounce it more like Pear-Test.  I'm pretty sure it's par like in golf."


apm <at> mara:~/projects/scala-pick/test$ ../build/pack/bin/scalac -Xexperimental -d /tmp files/run/virtpatmat_opt_sharing.scala
files/run/virtpatmat_opt_sharing.scala:4: warning: match may not be exhaustive.
It would fail on the following inputs: List((x: Int forSome x not in 1), 3, _), List(_, (x: Int forSome x not in 3), _), List(_, (x: Int forSome x not in 3), _, (x: Int forSome x not in (5, 6))), List(_, (x: Int forSome x not in 3), _, (x: Int forSome x not in (6, 7))), List(_, (x: Int forSome x not in 3), _, (x: Int forSome x not in 6)), List(_, (x: Int forSome x not in 3), _, 6), List(_, (x: Int forSome x not in 3), _, ??), List(_, _, (x: Int forSome x not in 4))
    List(1, 3, 4, 7) match {
        ^
one warning found
apm <at> mara:~/projects/scala-pick/test$ ../build/pack/bin/scalac -Xexperimental -d /tmp files/run/virtpatmat_opt_sharing.scala
files/run/virtpatmat_opt_sharing.scala:4: warning: match may not be exhaustive.
It would fail on the following inputs: List((x: Int forSome x not in 1), 3, 4, (x: Int forSome x not in (5, 6))), List(_, (x: Int forSome x not in 3), _, _), List(_, 3, (x: Int forSome x not in 4), (x: Int forSome x not in (5, 6, 7))), List(_, 3, 4, (x: Int forSome x not in (5, 6, 7)))
    List(1, 3, 4, 7) match {
        ^
one warning found
apm <at> mara:~/projects/scala-pick/test$ ../build/pack/bin/scalac -Xexperimental -d /tmp files/run/virtpatmat_opt_sharing.scala
files/run/virtpatmat_opt_sharing.scala:4: warning: match may not be exhaustive.
It would fail on the following inputs: List(1, (x: Int forSome x not in 3), 4, 5), List(_, (x: Int forSome x not in 3), 4, 7), List(_, _, (x: Int forSome x not in 4)), List(_, _, (x: Int forSome x not in 4), _), List(_, _, 4, (x: Int forSome x not in (5, 6, 7)))
    List(1, 3, 4, 7) match {
        ^

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
iulian dragos | 23 May 2013 21:41
Picon
Gravatar

"bad symbolic reference" comes and goes

It seems that Scala 2.10.0 shows this error.. erroneously. Here's a StackOverflow question:


Note that the missing type is `scala.Either`, and I can't imagine the compiler getting that far without a valid Scala library on the classpath. Similar errors were reported on the IDE issue tracker (more importantly, they "go away" after a clean):


I'm wondering whether this is masking another error, maybe CyclicReference, or some other exception that is caught at some far-away place and converted to a MissingRequirement. I mention it here because I don't have a way to reproduce it, but it seems annoying enough that we should investigate. Maybe the StackOverflow OP will give us a reproducible example..

iulian

--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Simon Ochsenreither | 23 May 2013 21:24
Picon

Re: Adding bit-operations to RichInt/RichLong


// NOTE: no implicit conversion
class RichBitOps32
This way you explicitly state in your code that you're doing an operation on 32 bits.  However, you should use short method names inside RichBitOps32 so that the whole thing isn't too clunky.

This looks pretty cumbersome and inconsistent with the twenty-something existing bit operations on Int/Long/... Or does this mean that we'll be deprecating and moving them, too?

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Paul Phillips | 23 May 2013 18:46

more great moments in type caching

Subtitle: "the evil that caches do"

scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor
res0: Boolean = true

scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor
res1: Boolean = false

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
James Iry | 23 May 2013 03:45
Favicon
Gravatar

Scala 2.10.2-RC1 is now available!

We are very happy to announce the RC1 release of Scala 2.10.2-RC1  If no serious blocking issues are found this will become the final 2.10.2 version.

The Scala team and contributors fixed 89 issues since 2.10.1!

In total, 164 RC1 pull requests were opened on GitHub, of which 134 were merged after having been tested and reviewed.

Known Issues

Before reporting a bug, please have a look at these known issues.

Scala IDE for Eclipse

The Scala IDE with Scala 2.10.2-RC1 built right in is available through one of the following update-sites:

Have a look at the getting started guide for more info.


--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Simon Ochsenreither | 23 May 2013 02:44
Picon

Adding bit-operations to RichInt/RichLong

Hi,

I added methods like bitCount, numberOfLeadingZeros, rotateLeft, ... which existed as static members on java.lang.Integer/java.lang.Long to RichInt/RichLong in this branch: https://github.com/soc/scala/tree/topic/int-long-bitops

The reasoning behind it is to have

  • "all" operations in a single place, with a consistent API
  • less explicit dependencies on the JDK
  • less need for users to import Java classes for basic functionality

One question is the naming: Every operation seems to have a few alternative names, we could evaluate each operation on a case-to-case base or we can decide to pick the same as Java. I checked C#, and they don't seem to provide these operations at all.

Another question is whether smaller types like Byte or Short will automatically gain these methods if we add them to RichInt/RichLong (not sure how the implicit widening conversions interact with the implicit def from <Num> to Rich<Num>), because some methods might exhibit unintuitive semantics here (e. g. reverse will always be zero).

Ideas/objections/opinions?

Thanks and bye,

Simon

/CC'ing Erik

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Simon Ochsenreither | 23 May 2013 01:42
Picon

Why do several methods on numbers involve multiple indirections including typeclasses and boxing?

For instance, take 1L.abs:

Instead of just computing and returning the result (like it is done in RichInt), this is what happens:

  • RichLong inherits abs by extending ScalaNumberProxy[T]
  • ScalaNumberProxy[T] has an abstract protected implicit def num: Numeric[T]
  • This method is implemented in RichLong and points to scala.math.Numeric.LongIsIntegral
  • The actual method abs now calls num.abs(self)

Same story for doubleValue, floatValue, longValue, intValue, byteValue, shortValue, min, max, signum.

I have not benchmarked it, but I think this is a "bit" slower than just implementing the method.

Is there a reason why we don't just do that?

Thanks,

Simon

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Miguel Garcia | 21 May 2013 22:38
Picon
Favicon

Late-Closure-Classes and specialization


Background: "Late-Closure-Classes" refers to a code-generation technique internal to the new backend ( http://magarciaepfl.github.io/scala/ ) that results in anon-closure-classes exposing the same API as before. If they're behaviorally identical to "traditional" anon-closure-classes, what's the point? Actually the new scheme sports several advantages (listed below) but this post focuses on their interplay with specialization, to answer recent questions.


  (a) A late-closure-class is specialized when -no-specialization is false, and not specialized otherwise.
      Exactly like traditional anon-closure-classes.

      Compare for the anon-function in:

        class C {
          def m() {
            (1 to 10) foreach { i => println(i) }
          }
        }

     Bytecode for the anon-closure-class above:

The example also shows where the "closure body" now lives: not in the anon-closure-class but in the original enclosing class. Why would one do that? How about this: laying the groundwork for lambdas-as-MethodHandles. In case a MethodHandle replaces an anon-closure-class, well, then there's no way anymore for a closure-body to remain in a non-existent class.

Although the API is the same, late-closures save a method call: a bridge-apply directly targets the "most specialized" method. In contrast, for traditional closures, an apply invocation initially landing at the "least specialized" method follows a daisy-chain before landing at the most specialized one. That's additional bytecode, too.

This brings us to the other advantages of late-closure-classes:

  (b) smaller constant pools, ie good for mobile apps, faster classloading, shorter startup time.

  (c) completely avoids "cannot inline" situations in the (new) optimizer

  (d) fewer heap objects are retained via "closure state minimization",
      https://github.com/magarciaEPFL/scala/commit/060eaa842a14bf3353ce3f0ed946b05c86e6e9a7


Regarding future work, yes, there are further improvements waiting to be realized. For the snippet below the new backend falls back to the traditional scheme:

    def abc[ <at> specialized(Int, Char) T](xs: Array[T]) {
      xs foreach { x => println(x) }
    }

"Falling back to traditional anon-closure-classes" means, we aren't any worse off than before. But yes, that's an example where late-closure-classes could do better. Handling that case requires teaching the specialize phase about Late-Closure-Classes, definitely possible but for the moment nowhere near essential.


And not to be forgotten, late-closure-classes contribute to the 15% speedup of the new backend over the current one.


Miguel
http://lampwww.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/


--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Roland Kuhn | 21 May 2013 15:32
Favicon

where does this name come from?

Welcome to Scala version 2.11.0-M3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_45).
Type in expressions to have them evaluated.
Type :help for more information.

scala> trait X extends scala.concurrent.ExecutionContext { val name = "" }
<console>:7: error: overriding value name in trait ExecutionContext of type String;
 value name needs `override' modifier
       trait X extends scala.concurrent.ExecutionContext { val name = "" }
                                                               ^

scala> trait X extends scala.concurrent.ExecutionContext { val namen = "" }
defined trait X

For those of you who wonder why this is relevant, here is javap listing for interface ExecutionContext:

public interface scala.concurrent.ExecutionContext{
    public abstract void execute(java.lang.Runnable);
    public abstract void reportFailure(java.lang.Throwable);
    public abstract scala.concurrent.ExecutionContext prepare();
}

No “name” field anywhere. I guess it comes from this part of the source:

  def reportFailure( <at> deprecatedName('t) cause: Throwable): Unit

I assume that I shall file a ticket?

Regards,


Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Empowering professional developers to build amazing apps.
twitter:  <at> rolandkuhn

See you at Scala Days 2013 in NYC!
June 10th - June 12th
www.scaladays.org

--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Scala Mailing Lists | 21 May 2013 15:32
Picon
Picon
Favicon

Mailing list reminder: Scala-internals

Welcome to the "Scala-internals" mailing list.

This automatic reminder is sent once a month to the list,
to keep subscribers up-to-date with the mailing list services,
and to help keeping the list on topic.

-------------------------------------------------------------------

The "Scala-internals" mailing list:

This is the mailing list that developers of the Scala
compiler and libraries use to discuss the core internal
design and the implementation of the Scala system.

This list is normally only used by developers who
commit code to the Scala code base; it is open to the
general public in order to make the development process
more transparent.

Please only create new threads if you commit to the
Scala code base, and you need to discuss the internals
of the Scala system.

General programming questions and bug reports should be
addressed to "scala-user" instead. For all general
questions and other discussions, please use the
"scala-language" mailing list instead.

-------------------------------------------------------------------

Other information:

There are several Scala lists devoted to individual topics (and
more may be created in the future). For the full list, please
see: http://www.scala-lang.org/node/199

Try to avoid cross-posting whenever possible. If you can, select
the list that is closer to your topic and post in that list only.
In any case, never cross-post replies.

If you ever want to unsubscribe from this list, just visit this
page: http://groups.google.com/group/scala-internals/subscribe
or send an email to scala-internals+unsubscribe@...

Thank you!
The Scala Team

--

-- 
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-internals+unsubscribe@...
For more options, visit https://groups.google.com/groups/opt_out.


Gmane