This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Answers http://stackoverflow.com/questions/10373318/mixing-in-a-trait-dynamically. | |
Compile as follows: | |
scalac Common_1.scala Macros_2.scala | |
scalac Common_1.scala Test_3.scala -cp <path to the result of the previous compilation> | |
Tested in 2.10.0-M3, will most likely not compile by the time 2.10.0 final is released, because we're actively rehashing the API. | |
However the principles will remain the same in the final release, so the concept itself is okay. | |
upd. Code updated for 2.10.0-M7. | |
upd. Code updated for 2.10.0-RC1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myke rebuild-alt-compiler C:\Projects\Perf_Bad | |
psi: filename = cmd.exe, arguments = /C ant build -buildfile build.xml, home = C:\Projects\Perf_Bad | |
Buildfile: C:\Projects\Perf_Bad\build.xml | |
init.jars.check: | |
init.jars: | |
init: | |
[echo] build time: 1 May 2012, 16:07:05 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myke rebuild-alt-compiler C:\Projects\Perf_Good | |
psi: filename = cmd.exe, arguments = /C ant build -buildfile build.xml, home = C:\Projects\Perf_Good | |
Buildfile: C:\Projects\Perf_Good\build.xml | |
init.jars.check: | |
init.jars: | |
init: | |
[echo] build time: 1 May 2012, 16:09:44 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myke run-test C:\Projects\Perf_Bad\build.xml | |
psi: filename = cmd.exe, arguments = /C ant -Djavac.args=-Dmyke.comments=macro_materializers_enabled quick.comp -buildfile build.xml, home = C:\Projects\Perf_Bad | |
Buildfile: C:\Projects\Perf_Bad\build.xml | |
init.jars.check: | |
init.jars: | |
init: | |
[echo] build time: 2 May 2012, 18:39:36 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myke run-test C:\Projects\Perf_Bad\src\compiler\scala\tools\nsc\typechecker\Implicits.scala | |
psi: filename = cmd.exe, arguments = /C ant -Djavac.args=-Dmyke.comments=macro_materializers_disabled quick.comp -buildfile build.xml, home = C:\Projects\Perf_Bad | |
Buildfile: C:\Projects\Perf_Bad\build.xml | |
init.jars.check: | |
init.jars: | |
init: | |
[echo] build time: 2 May 2012, 18:42:39 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait StuffBase { | |
type Base | |
type Foo <: Base | |
val Foo: FooExtractor | |
implicit val FooTag: ClassTag[Foo] | |
abstract class FooExtractor { | |
def apply(x: Int): Foo | |
def unapply(foo: Foo): Option[Int] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait StuffBase { | |
type Foo | |
implicit val FooTag: ClassManifest[Foo] | |
} | |
object Stuff extends StuffBase { | |
class Foo | |
implicit val FooTag = classManifest[Foo] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scala.reflect.runtime | |
package object eval { | |
implicit class PimpedExpr[T](expr: scala.reflect.api.JavaUniverse # Expr[T]) { | |
def runtimeEval: T = { | |
import scala.tools.reflect._ | |
val u0 = expr.mirror.universe | |
val expr0 = expr.asInstanceOf[u0.Expr[T]] | |
val factory = universe2ToolBoxFactory(expr0.mirror)(u0) | |
val toolbox = factory.mkToolBox() |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myke run-all-tests C:\Projects\KeplerUnderRefactoring | |
git: branch = topic/reflection, commit = 0ce5eeebeaf11dbd27e163c1da0121aad83fa14f | |
psi: filename = cmd.exe, arguments = /C ant -Dscalac.args="""""" build -buildfile build.xml, home = C:\Projects\KeplerUnderRefactoring | |
Buildfile: C:\Projects\KeplerUnderRefactoring\build.xml | |
init.jars.check: | |
init.jars: | |
[echo] Updating bootstrap libs. (To do this by hand, run ./pull-binary-libs.sh) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** The class for all symbols */ | |
abstract class Symbol protected[Symbols] (initOwner: Symbol, initPos: Position, initName: Name) | |
extends SymbolContextApiImpl | |
with HasFlags | |
with SymbolFlagLogic | |
with SymbolCreator | |
// with FlagVerifier // DEBUG | |
with Annotatable[Symbol] { | |
if (initName.toString == "scala") { |