Skip to content
Snippets Groups Projects
Commit 57343da0 authored by Max Leuthäuser's avatar Max Leuthäuser
Browse files

- initial commit

parents
No related branches found
No related tags found
No related merge requests found
.DS_Store
.idea/
project/
target/
*.iml
*.class
classes_gen*
source_gen*
.cache
.classpath
.project
.settings/
/bin/
This diff is collapsed.
SCROLLBoot
==========
Small SCROLL boot demo application build with Scala to show how to use [SCROLL][scroll] (*SCala ROLes Language*) in your Scala project.
**Edit and develop:**
1. Install [SBT][sbt] (Scala Build Tool).
2. Clone this repository.
3. Set up your favorite IDE:
3.1. For Intellij: run ```sbt gen-idea``` and open the generated project with Intellij.
3.2. For Eclipse: run ```sbt eclipse``` and import the generated project with Eclipse.
4. Run it with ```sbt run``` or directly with your IDE as Scala Application (```src/main/scala/SCROLLBoot.scala```).
[scroll]: https://github.com/max-leuthaeuser/SCROLL
[sbt]: http://www.scala-sbt.org/0.13/tutorial/index.html
\ No newline at end of file
name := "SCROLLBoot"
lazy val commonSettings = Seq(
organization := "tu.dresden.de",
version := "0.0.1",
scalaVersion := "2.11.7",
scalacOptions := Seq("-unchecked", "-deprecation", "-feature", "-encoding", "utf8")
)
lazy val main = (project in file(".")).settings(commonSettings: _*).
settings(
libraryDependencies ++= Seq(
"com.github.max-leuthaeuser" % "scroll_2.11" % "latest.integration"
)
)
// gen-idea plugin
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
// eclipse plugin
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
import annotations.Role
import scroll.internal.Compartment
object SCROLLBoot extends App {
/**
* Just a simple natural type.
* Can not do anything but printing some statement on stdout.
*/
class SomePlayer {
def hello(): Unit = {
println("Hello World from some player!")
}
}
/**
* A new compartment. Only containing one role for demo purposes.
*/
class SomeCompartment extends Compartment {
/**
* A role that will be bound to [[SomePlayer]] later on
* and will alter its behaviour.
*/
@Role class SomeRole {
def hello(): Unit = {
println("Hello World from some role!")
}
}
}
val player = new SomePlayer()
/**
* This will use the standard behaviour defined in the natural type.
*/
player.hello()
/**
* Creating an anonymous instance of the [[Compartment]] defined above.
*/
new SomeCompartment {
/**
* Creating a play-relation now and calling the compound-objects behaviour
* which is actually defined in its role [[SomeRole]].
*/
player play new SomeRole() hello()
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment