- JRebelを利用すると、アプリケーションの再起動なしで実行中のアプリケーションに加えた変更を即座に反映することができます(ホットリローディング)。まるでPHPのようにサクサク書けるッ!
- Scala開発者にはライセンスが$0で提供されます。Javaで利用する場合は購入してね☆彡
以下がインストールされているものとする。
| trait Magma[A] { | |
| def append(x: A, y: A): A | |
| } | |
| object Magma { | |
| implicit def Monoid[A](implicit m: Monoid[A]) = new Magma[A] { | |
| def append(x: A, y: A) = m.append(x, y) | |
| } | |
| } |
以下がインストールされているものとする。
| using System; | |
| using System.Collections.Generic; | |
| namespace Utils | |
| { | |
| public class UnknownTypeException : Exception | |
| { | |
| } | |
| public class TypeRegistry |
| #! /bin/sh | |
| # Set up a default search path | |
| PATH="/usr/bin:/bin" | |
| CURL=`which curl` | |
| if [ -z "$CURL" ]; then | |
| echo "curl not found" | |
| exit 1 | |
| fi |
| class Outer { | |
| class Inner | |
| type Type | |
| } | |
| trait Trait | |
| object Object extends Outer { | |
| val inner = new Inner | |
| } | |
| class OuterP[A] { | |
| class InnerP[B] |
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
Tested in 2.10.0
===Common_1.scala===
| import sbt._ | |
| import Keys._ | |
| import Build.data | |
| object build extends Build { | |
| lazy val runAll = TaskKey[Unit]("run-all") | |
| lazy val standardSettings = Seq( | |
| runAllIn(Compile) | |
| ) |
| import scala.language.postfixOps | |
| import scala.concurrent._ | |
| import scala.concurrent.duration._ | |
| import akka.pattern.pipe | |
| import akka.actor._ | |
| import akka.cluster.routing._ | |
| /** | |
| * Concept and some code lifted from | |
| * https://github.com/jsuereth/intro-to-fp, thanks Josh! |
| class ClusterMetricsElasticScaleListener extends Actor with ActorLogging { | |
| val selfAddress = Cluster(context.system).selfAddress | |
| override def preStart(): Unit = | |
| Cluster(context.system).subscribe(self, classOf[ClusterMetricsChanged]) | |
| override def postStop(): Unit = | |
| Cluster(context.system).unsubscribe(self) | |
| def receive = { |
| scalaVersion := "2.10.0" | |
| // Let's support all "modern" Scala versions. | |
| crossScalaVersions := Seq( | |
| "2.9.3-RC1", | |
| "2.9.2", | |
| "2.9.1", "2.9.1-1", | |
| "2.9.0", "2.9.0-1", | |
| "2.8.0", "2.8.1", "2.8.2" | |
| ) |