|
NonNull, scala.reflect: msg#00019lang.scala
I've seen recent checkins on Scala2 for a NonNull -- did a few quick checks and it seems like a _very_ useful new feature! Given: trait Node extends NonNull; case class Tree(left: Node, right: Node) extends Node; case class Leaf(val v: String) extends Node; case object EmptyNode extends Node; It is legal to write: val legal = Tree(Tree(EmptyNode, Leaf("Steve")), Leaf("Something")); But not legal to write: val illegal = Tree(Tree(null, Leaf("Steve")), Leaf("Arrgh")); I'm sure this will find its way into many programs. I am a bit curious about the status of the scala.reflect package. I believe that the overall intent is that attributes (metadata) attached to Scala elements will be visible through the scala.reflect package. Right now the Codification/Reify phase in the compiler is not used, and the attributes are not generated into the resulting program. The pickled ScalaSig has them (I think), but the unpickler is part of the compiler and not accessible at runtime. It looks like the unpickler is fairly specialized in any case so it can participate in the full compiler framework. Only a subset of the pickled information is needed to satisfy scala reflection requirements. My guess is that the reflect.Symbol class will eventually contain an attributes field in addition to owner, name and type, and that programmer-defined attributes will make their way there. It's interesting to note that generated attributes could also be added to a symbol (by a code generator like GenJVM), and these would also be visible to a running program. RJ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: "scala" script and classpaths: 00019, Jamie Webb |
|---|---|
| Next by Date: | Re: "scala" script and classpaths: 00019, Lex Spoon |
| Previous by Thread: | RE: "scala" script and classpathsi: 00019, Judson, Ross |
| Next by Thread: | Eclipse plugin... scala/java mixed: 00019, Nathan Sobo |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |