-
-
Notifications
You must be signed in to change notification settings - Fork 12
Other SCROLL related Projects
Code generation from CROM models to SCROLL code.
This project contains the @Inspect
annotation supporting the SCROLL reflection magic. Querying for role-specific structure is done during the instantiation phase and gets cached.
This project contains a Scala compiler plugin supporting SCROLL using static code analysis to give the developer more hints/warnings on role-binding / method resolution.
Consider the following example:
class Person(val firstName: String)
val peter = new Person("Peter")
new Compartment {
println(+peter fullName)
}
With SCROLL, the code would still execute normally but will print:
Left(No role with behavior 'fullName' could be found for the player 'Person@39d87c5f'!)
All calls to role-specific behavior or structure always returns an instance of Either. With the Scala Dynamic Trait no static type-checks are possible anymore. Hence, the SCROLLCompilerPlugin will generate meaningful warnings/errors for you, e.g., here:
[error] Test.scala:6: selectDynamic as 'fullName' detected on: 'Person'.
[error] No dynamic extensions specified for 'Person'!
[error] println(+peter fullName)
[error] ^
[error] Test.scala:6: Neither 'Person', nor its dynamic extensions offer the called behavior!
[error] This may indicate a programming error!
[error] println(+peter fullName)
[error]
So we can fix this.
class Person(val firstName: String)
val peter = new Person("Peter")
new Compartment {
class PersonExtension(val lastName: String) {
def fullName(): String = {
val first: String = +this firstName
val last: String = lastName
first + " " + last
}
}
val name: String = peter play new PersonExtension("Meier") fullName()
println(name)
}
[warn] Test.scala:6: applyDynamic as 'fullName' detected on: 'Person'.
[warn] For 'Person' the following dynamic extensions are specified:
[warn] - 'Person' -> 'PersonExtension'
[warn] Make sure at least one of the following dynamic extensions is bound:
[warn] - 'PersonExtension' maybe bound at:
[warn] [line:14|col:28] at source '.../Test.scala'
[warn] ...
[warn] val name: String = peter play new PersonExtension("Meier") fullName()
[warn]
Small SCROLL boot demo application build with Scala to show how to use SCROLL in your Scala project.
SCROLL "Hello World!" example project for Android. Warning: it uses a very old SCROLL (0.9.1).