Value class issue

135 views
Skip to first unread message

Mirco Dotta

unread,
Nov 16, 2012, 11:41:49 AM11/16/12
to scala-i...@googlegroups.com
Hey guys,

Today I was playing with value classes using Scala 2.10.0-RC2 and hit a compiler crash. 

I had a quick look at the existing tickets, but I couldn't find a match. The closest one seem 
https://issues.scala-lang.org/browse/SI-6357, though here we have a crash, instead of a 
false negative.


object Foo {
  def main(args: Array[String]) = execute {
    class VInt(val v: Int) extends AnyVal
  }

  def execute(body: => Unit): Unit = body
} 

java.lang.AssertionError: assertion failed: 
     while compiling: /Users/mirco/Projects/tes/src/main/scala/C.scala
        during phase: global=typer, atPhase=namer
     library version: version 2.10.0-RC2
    compiler version: version 2.10.0-RC2
  reconstructed args: -Xpluginsdir /Applications/dev/eclipse-indigo-210 copy/configuration/org.eclipse.osgi/bundles/905/1/.cp/lib -classpath /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar:/System/Library/Java/Extensions/AppleScriptEngine.jar:/System/Library/Java/Extensions/dns_sd.jar:/System/Library/Java/Extensions/j3daudio.jar:/System/Library/Java/Extensions/j3dcore.jar:/System/Library/Java/Extensions/j3dutils.jar:/System/Library/Java/Extensions/jai_codec.jar:/System/Library/Java/Extensions/jai_core.jar:/System/Library/Java/Extensions/mlibwrapper_jai.jar:/System/Library/Java/Extensions/MRJToolkit.jar:/System/Library/Java/Extensions/QTJava.zip:/System/Library/Java/Extensions/vecmath.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar:/Users/mirco/Projects/tes/target/scala-2.10/classes:/Users/mirco/Projects/tes/target/scala-2.10/test-classes:/Users/mirco/Projects/tes/lib/akka-actor_2.10.0-RC2-2.1.0-RC2-sources.jar:/Users/mirco/Projects/tes/lib/akka-actor_2.10.0-RC2-2.1.0-RC2.jar:/Applications/dev/eclipse-indigo-210 copy/configuration/org.eclipse.osgi/bundles/906/1/.cp/lib/scala-swing.jar:/Applications/dev/eclipse-indigo-210 copy/configuration/org.eclipse.osgi/bundles/906/1/.cp/lib/scala-actors.jar:/Applications/dev/eclipse-indigo-210 copy/configuration/org.eclipse.osgi/bundles/905/1/.cp/lib/scala-reflect.jar:/Users/mirco/.ivy2/cache/com.typesafe.akka/akka-actor_2.10.0-RC2/bundles/akka-actor_2.10.0-RC2-2.1.0-RC2.jar:/Users/mirco/.ivy2/cache/com.typesafe/config/bundles/config-1.0.0.jar:/Users/mirco/.ivy2/cache/com.typesafe.akka/akka-testkit_2.10.0-RC2/jars/akka-testkit_2.10.0-RC2-2.1.0-RC2.jar -bootclasspath /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsfd.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Resources/Java/JavaRuntimeSupport.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/laf.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/sunrsasign.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar:/Applications/dev/eclipse-indigo-210 copy/configuration/org.eclipse.osgi/bundles/906/1/.cp/lib/scala-library.jar -Ypresentation-debug -Ypresentation-verbose

  last tree to typer: Ident(Int)
              symbol: <none> (flags: )
   symbol definition: <none>
       symbol owners: 
      context owners: class VInt -> method main -> object Foo -> package <empty>

== Enclosing template or block ==

Template( // val <local VInt>: <notype> in class VInt
  "AnyVal" // parents
  ValDef(
    private
    "_"
    <tpt>
    <empty>
  )
  // 2 statements
  ValDef( // private[this] val v: Int in class VInt
    private <local> <paramaccessor>
    "v"
    "Int"
    <empty>
  )
  DefDef( // def <init>: <?> in class VInt
    <method>
    "<init>"
    []
    // 1 parameter list
    ValDef(
      <param> <paramaccessor>
      "v"
      "Int"
      <empty>
    )
    <tpt>
    Block(
      Apply(
        super."<init>"
        Nil
      )
      ()
    )
  )
)

<paramaccessor> private[this] val v: Int = _
at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$Getter.validate(MethodSynthesis.scala:402)
at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$DerivedFromValDef$class.derive(MethodSynthesis.scala:349)
at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$Getter.derive(MethodSynthesis.scala:391)
at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$$anonfun$addDerivedTrees$1.apply(MethodSynthesis.scala:226)
at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$$anonfun$addDerivedTrees$1.apply(MethodSynthesis.scala:226)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
at scala.collection.immutable.List.foreach(List.scala:309)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
at scala.collection.AbstractTraversable.map(Traversable.scala:105)
at scala.tools.nsc.typechecker.MethodSynthesis$MethodSynth$class.addDerivedTrees(MethodSynthesis.scala:226)
at scala.tools.nsc.typechecker.Namers$Namer.addDerivedTrees(Namers.scala:55)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$29.apply(Typers.scala:1860)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$29.apply(Typers.scala:1860)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1798)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$rewrappingWrapperTrees$1.apply(Typers.scala:1795)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:251)
at scala.collection.immutable.List.foreach(List.scala:309)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:251)
at scala.collection.AbstractTraversable.flatMap(Traversable.scala:105)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1860)
at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1726)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5400)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2770)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
at scala.collection.immutable.List.loop$1(List.scala:164)
at scala.collection.immutable.List.mapConserve(List.scala:180)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2870)
at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2340)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5387)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2880)
at scala.tools.nsc.typechecker.Typers$Typer.loop$1(Typers.scala:2907)
at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:2913)
at scala.tools.nsc.typechecker.Typers$Typer.handleMonomorphicCall$1(Typers.scala:3172)
at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3216)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$86.apply(Typers.scala:4422)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$86.apply(Typers.scala:4422)
at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:721)
at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$1(Typers.scala:4422)
at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4475)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4508)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5381)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5526)
at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:5621)
at scala.tools.nsc.typechecker.Namers$Namer.assignTypeToTree(Namers.scala:813)
at scala.tools.nsc.typechecker.Namers$Namer.methodSig(Namers.scala:1051)
at scala.tools.nsc.typechecker.Namers$Namer.getSig$1(Namers.scala:1305)
at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1347)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply$mcV$sp(Namers.scala:709)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:708)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1$$anonfun$apply$1.apply(Namers.scala:708)
at scala.tools.nsc.typechecker.Namers$Namer.scala$tools$nsc$typechecker$Namers$Namer$$logAndValidate(Namers.scala:1385)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:708)
at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$monoTypeCompleter$1.apply(Namers.scala:707)
at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1496)
at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter$class.complete(Namers.scala:1504)
at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1494)
at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1217)
at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1349)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5119)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2770)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
at scala.collection.immutable.List.loop$1(List.scala:164)
at scala.collection.immutable.List.mapConserve(List.scala:180)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2870)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1862)
at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1769)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5401)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2770)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$55.apply(Typers.scala:2870)
at scala.collection.immutable.List.loop$1(List.scala:164)
at scala.collection.immutable.List.mapConserve(List.scala:180)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2870)
at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5127)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5404)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5458)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5509)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:98)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:461)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:90)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1156)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:90)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1574)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1548)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1544)
at scala.tools.nsc.Global$Run.compile(Global.scala:1654)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:115)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:89)
at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:74)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:36)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:30)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:72)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:72)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:72)
at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:129)
at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:71)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:112)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:60)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22)
at sbt.inc.Incremental$.cycle(Incremental.scala:40)
at sbt.inc.Incremental$.compile(Incremental.scala:25)
at sbt.inc.IncrementalCompile$.apply(Compile.scala:20)
at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:120)
at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44)
at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:31)
at sbt.compiler.IC$.compile(IncrementalCompiler.scala:20)
at scala.tools.eclipse.buildmanager.sbtintegration.EclipseSbtBuildManager.runCompiler(EclipseSbtBuildManager.scala:128)
at scala.tools.eclipse.buildmanager.sbtintegration.EclipseSbtBuildManager.update(EclipseSbtBuildManager.scala:118)
at scala.tools.eclipse.buildmanager.sbtintegration.EclipseSbtBuildManager.build(EclipseSbtBuildManager.scala:173)
at scala.tools.eclipse.ScalaProject.build(ScalaProject.scala:597)
at scala.tools.eclipse.ScalaBuilder.build(ScalaBuilder.scala:114)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


-- Mirco

Paul Phillips

unread,
Nov 16, 2012, 11:53:45 AM11/16/12
to scala-i...@googlegroups.com


On Fri, Nov 16, 2012 at 8:41 AM, Mirco Dotta <mirco...@typesafe.com> wrote:
Today I was playing with value classes using Scala 2.10.0-RC2 and hit a compiler crash. 

I had a quick look at the existing tickets, but I couldn't find a match. The closest one seem 
https://issues.scala-lang.org/browse/SI-6357, though here we have a crash, instead of a 
false negative.

The "casual stab" linked in the ticket fixes it:

% qscalac a.scala 
a.scala:6: error: value class may not be a local class
    class VInt(val v: Int) extends AnyVal
          ^
one error found

Mark Harrah

unread,
Nov 16, 2012, 11:54:45 AM11/16/12
to scala-i...@googlegroups.com
On Fri, 16 Nov 2012 17:41:49 +0100
Mirco Dotta <mirco...@typesafe.com> wrote:

> Hey guys,
>
> Today I was playing with value classes using Scala 2.10.0-RC2 and hit a compiler crash.
>
> I had a quick look at the existing tickets, but I couldn't find a match. The closest one seem
> https://issues.scala-lang.org/browse/SI-6357, though here we have a crash, instead of a
> false negative.

It no longer crashes with the fix in https://github.com/scala/scala/pull/1626. You might add the example to the bug report for the record, though. The output with the fix is:

Foo.scala:3: error: value class may not be a local class
class VInt(val v: Int) extends AnyVal
^

-Mark

Mirco Dotta

unread,
Nov 16, 2012, 12:12:05 PM11/16/12
to scala-i...@googlegroups.com, scala-i...@googlegroups.com
Wow, that was fast! :)

Is the fix going into RC3? (assuming there will be one...)

-- Mirco

Sent from my mobile

Daniel Sobral

unread,
Nov 16, 2012, 12:25:40 PM11/16/12
to scala-i...@googlegroups.com
On Fri, Nov 16, 2012 at 3:12 PM, Mirco Dotta <mirco...@typesafe.com> wrote:
Wow, that was fast! :)

Is the fix going into RC3? (assuming there will be one...)

Given that there has been commit on 2.10.0-wip, I assume there will be an RC3. Or, at the very least, that 2.10.0.final will not be identical to 2.10.0-RC2.



--
Daniel C. Sobral

I travel to the future all the time.

Simon Ochsenreither

unread,
Nov 16, 2012, 12:30:20 PM11/16/12
to scala-i...@googlegroups.com
Btw, looks like some people copied SIP-15 already: http://openjdk.java.net/jeps/169 :-D

Mirco Dotta

unread,
Nov 16, 2012, 1:05:00 PM11/16/12
to scala-i...@googlegroups.com
On Nov 16, 2012, at 6:25 PM, Daniel Sobral wrote:

On Fri, Nov 16, 2012 at 3:12 PM, Mirco Dotta <mirco...@typesafe.com> wrote:
Wow, that was fast! :)

Is the fix going into RC3? (assuming there will be one...)

Given that there has been commit on 2.10.0-wip, I assume there will be an RC3. Or, at the very least, that 2.10.0.final will not be identical to 2.10.0-RC2.

Right.

By the way, the reason why I'm asking if the fix will make it in RC3 is because it is *extremely 
easy* to hit when using the Scala Worksheet, i.e., any value class defined in a worksheet will 
pretty much always trigger the reported compiler crash.

-- Mirco

Vlad Ureche

unread,
Nov 16, 2012, 5:20:59 PM11/16/12
to scala-i...@googlegroups.com, Miguel Garcia

On Fri, Nov 16, 2012 at 6:30 PM, Simon Ochsenreither <simon.och...@gmail.com> wrote:
Btw, looks like some people copied SIP-15 already: http://openjdk.java.net/jeps/169 :-D

Awesome! Thanks for pointing it out Simon! [though I think starting a new topic would have been better]

One of the tough problems is how to return value classes in the absence of multi-slot/struct returns in the bytecode: you can recreate the value class instance and return a reference but it's expensive, or you can have a separate storage for returns and put values there, but this is hard to manage. In JEP-169 they suggest the JVM might do multi-slot returns in the native code generated, which we could leverage for Scala value classes. What's more, the way the proposal is formulated would allow us use the feature with just a few changes in the Scala backend.

Let's see how it goes, it will be interesting to follow.

Cheers,
Vlad

Simon Ochsenreither

unread,
Nov 16, 2012, 5:56:37 PM11/16/12
to scala-i...@googlegroups.com, Miguel Garcia
No problem, Vlad. :-)

From my perspective, the development of Java at Oracle gets increasingly underwhelming.

Half of the JEPs are more or less blatant rip-offs of stuff Scala is shipping (sometimes) since years already. Short list of stuff which should sound at least familiar:

JEP 101: Generalized Target-Type Inference
JEP 103: Parallel Array Sorting

JEP 104: Annotations on Java Types

JEP 105: DocTree API

JEP 107: Bulk Data Operations for Collections

JEP 108: Collections Enhancements from Third-Party Libraries

JEP 109: Enhance Core Libraries with Lambda

JEP 118: Access to Parameter Names at Runtime

JEP 119: javax.lang.model Implementation Backed by Core Reflection

JEP 120: Repeating Annotations

JEP 126: Lambda Expressions and Virtual Extension Methods

JEP 139: Enhance javac to Improve Build Speed

JEP 155: Concurrency updates (jsr166e)

JEP 160: Lambda-Form Representation for Method Handles

JEP 169: Value Objects


Nothing wrong with that ... but why don't they focus their work on JVM features which are NOT implementable in the compiler instead of adding JVM support for stuff Scala manages to deal with in the compiler?


Looking at the last 2 weeks of Java 8 starts looking like a burning train-wreck.

Optional is completely botched, their Function types are completely insane, default methods look more and more like a compiler feature, what should have been a simple "bulk operation" API is now riddled with useless overhead (list.stream() ...... into(new ArrayList<>())), they are starting to specialize types by hand ... I'm not sure what's wrong with those people.

How can they fail so blatantly, despite years of experience and working examples from tons of people?

I'm currently deeply frustrated about the evolution of the Java platform ... they always tell people that they don't manage to ship features, because they want to get them "right". Looks like they don't even manage to do that.

Back to writing Scala code ... ;-D

Ruediger Keller

unread,
Nov 17, 2012, 5:49:31 AM11/17/12
to scala-i...@googlegroups.com
Hello,

personally, I am quite happy to finally see support for value types
coming to the JVM. There's only so much you can do with the compiler
without JVM support. Btw. John Rose blogged about value types in the
JVM over 5 years ago, so I think you can hardly say it's just a ripoff
of a recent Scala feature:

https://blogs.oracle.com/jrose/entry/tuples_in_the_vm

Also, there are other exciting developments regarding the JVM. There's
a talk by John Rose about Arrays 2.0, with some amazing ideas, also
mentioning arrays of value types (unfortunately not being included in
JEP 169, it seems):

http://wiki.jvmlangsummit.com/Arrays_2.0_64

And there's a talk showing some interesting ideas being explored by
Oracle for the future of Java, some of which sound like JVM
improvements (beginning at page 38):

http://de.slideshare.net/JAX_London/keynote-to-java-se-8-and-beyond-simon-ritter

And if Oracle is copying so many features from Scala, it just shows
that Scala is an amazing language! ;-)

Regards,
Ruediger

Mirco Dotta

unread,
Nov 17, 2012, 8:29:49 AM11/17/12
to scala-i...@googlegroups.com
Hi guys, you should really discuss this on a different thread, as it's out of topic
(maybe even a different ML, scala-debate looks like the right one to me).

Cheers,
Mirco
Reply all
Reply to author
Forward
0 new messages