Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
research:software:effscript [2015/06/03 18:34] – [Architectural Constraints in Play] mtoro | research:software:effscript [2015/08/04 21:33] – etanter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== EffScript: Practical Effects for Scala ====== | ====== EffScript: Practical Effects for Scala ====== | ||
+ | |||
+ | {{bib> | ||
EffScript is a small domain-specific language for writing tailored effect disciplines for Scala. In addition to being customizable, | EffScript is a small domain-specific language for writing tailored effect disciplines for Scala. In addition to being customizable, | ||
Line 8: | Line 10: | ||
The implementation of the Practical Effect system is developed as a compiler plugin for the Scala programming language. The plugin is based on the plugin developed by Rytz //et al// and is composed of two sub plugins to implement bidirectional checking: the effect inference plugin, and the effect checking plugin. The effect inference plugin is a modification of the one developed by Rytz //et al//, extended with support for gradual effects and the customizable effect system. In relation to bidirectional checking, Scala has inference of effect, therefore there are cases where there is absence of effect annotations. The effect inference plugin is necessary to annotate function abstractions that do not have effect annotations. This information about effect inference is used by the effect checking plugin to check and adjust | The implementation of the Practical Effect system is developed as a compiler plugin for the Scala programming language. The plugin is based on the plugin developed by Rytz //et al// and is composed of two sub plugins to implement bidirectional checking: the effect inference plugin, and the effect checking plugin. The effect inference plugin is a modification of the one developed by Rytz //et al//, extended with support for gradual effects and the customizable effect system. In relation to bidirectional checking, Scala has inference of effect, therefore there are cases where there is absence of effect annotations. The effect inference plugin is necessary to annotate function abstractions that do not have effect annotations. This information about effect inference is used by the effect checking plugin to check and adjust | ||
+ | ===== Getting Started Guide ===== | ||
==== The implementation ==== | ==== The implementation ==== | ||
- | The code and examples can be downloaded [[http:// | + | |
+ | The code and examples | ||
+ | |||
+ | Alternatively, | ||
+ | Access with username: ubuntu and password: ubuntu, all the code and examples can be found inside folder '' | ||
To run the examples, you need to have installed Scala (http:// | To run the examples, you need to have installed Scala (http:// | ||
- | In case we have java8 installed we need to update | + | In case we have Java 1.8 already |
<code bash> | <code bash> | ||
export JAVA_HOME=/ | export JAVA_HOME=/ | ||
Line 35: | Line 43: | ||
</ | </ | ||
- | sbt | ||
===== How to use the compiler plugins ===== | ===== How to use the compiler plugins ===== | ||
Line 51: | Line 58: | ||
bottom: @simpleNoIO | bottom: @simpleNoIO | ||
- | pointcuts: | + | effspecs: |
def views.html.dummy.apply() prod @simpleNoIO | def views.html.dummy.apply() prod @simpleNoIO | ||
def views.html.foo.apply[T]() prod @simpleNoIO | def views.html.foo.apply[T]() prod @simpleNoIO | ||
Line 60: | Line 67: | ||
</ | </ | ||
- | We first create the folder for our new project which we call '' | + | We first create the folder for our new project which we call '' |
< | < | ||
mkdir playground | mkdir playground | ||
Line 72: | Line 79: | ||
chmod +x copyCompilerLibs.sh #make sure the file has execution permissions | chmod +x copyCompilerLibs.sh #make sure the file has execution permissions | ||
./ | ./ | ||
- | </ | + | </ |
- Creating the symbolic links manually \\ Alternatively we can create the symbolic links manually. The '' | - Creating the symbolic links manually \\ Alternatively we can create the symbolic links manually. The '' | ||
cd playground | cd playground | ||
Line 136: | Line 143: | ||
< | < | ||
sbt | sbt | ||
- | compile | + | >compile |
</ | </ | ||
Line 162: | Line 169: | ||
<code bash> | <code bash> | ||
- | run | + | >run |
... | ... | ||
[error] (run-main-1) runtimePrivileges.RuntimePrivileges$EffectPrivilegeException: | [error] (run-main-1) runtimePrivileges.RuntimePrivileges$EffectPrivilegeException: | ||
Line 178: | Line 185: | ||
</ | </ | ||
+ | ====== Step by Step Instructions ====== | ||
===== Architectural Constraints in Play ===== | ===== Architectural Constraints in Play ===== | ||
- | The effscript | + | The effscript |
To modify the discipline, just edit the '' | To modify the discipline, just edit the '' | ||
Line 201: | Line 208: | ||
The template can be found in '' | The template can be found in '' | ||
- | To test the access to the database from the templates, just uncomment line 3 of file '' | + | To test the access to the database from the templates, just uncomment line 3 of file '' |
+ | < | ||
+ | @{models.Users.byId(1) : @scala.annotation.effects.unknown} | ||
+ | </ | ||
+ | And then reload the page: | ||
- | {{: | + | {{: |
To test that the EffectControllers only have access to insert '' | To test that the EffectControllers only have access to insert '' | ||
Line 213: | Line 224: | ||
And then reload the page to see how an static error is raised: | And then reload the page to see how an static error is raised: | ||
- | {{: | + | {{: |
Line 334: | Line 346: | ||
==== Using SBT ==== | ==== Using SBT ==== | ||
- | In case we do not have Scala 2.10 we can always run each benchmark by entering to the folder of the experiment, for instance: | + | In case we do not have Scala 2.10 we can always run each benchmark by entering to the folder of the experiment. The folders are the following: |
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | For instance: | ||
<code bash> | <code bash> | ||
Line 340: | Line 360: | ||
</ | </ | ||
- | And then to run the version 2 of the experiment, we run: | + | The versions of each experiment are the following: |
+ | * 0 => 95 dynamic checks and 67 context adjustements | ||
+ | * 1 => 35 dynamic checks and 67 context adjustements | ||
+ | * 2 => 35 dynamic checks and 67 context adjustements | ||
+ | * 3 => fully annotated (do not produce runtime effect checks) | ||
+ | |||
+ | For instance, | ||
<code bash> | <code bash> | ||
sbt "run 2" | sbt "run 2" | ||
</ | </ | ||
+ | |||
+ | ===== Plotting the results ===== | ||
+ | To plot the benchmark results we have provided a zip file with the required files [[http:// | ||
+ | |||
+ | |||
+ | You will need the following python libraries (I recommend install them using " | ||
+ | - numpy | ||
+ | - matplotlib | ||
+ | |||
+ | Place the content of the zip file inside the benchmark folder. Then, edit '' | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | n=1 | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | |||
+ | Before running the benchmarks we recommend re packaging the CollsSimple project: | ||
+ | <code bash> | ||
+ | cd CollsSimple | ||
+ | sbt package | ||
+ | </ | ||
+ | |||
+ | To run the benchmarks, at the root of the benchmarks folder run: | ||
+ | <code bash> | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | The execution will output the results in '' | ||
+ | |||
+ | To plot the results just run: | ||
+ | <code bash> | ||
+ | python buildGraph.py | ||
+ | </ | ||
+ | It will generate a '' | ||