Closed riedelcastro closed 10 years ago
Most awesome! Can I control whether there is reuse or not?
Yes, see aggregate
option in reference.conf.
For a running example, see wolfe/docs/examples/03_grids
, the server is up on earth.
This is nice. Another idea to cache compilation is to wrap each snippet cell in a "object" and create an own compilation unit for it. If a cell uses a previous cell, it simply imports that object into scope.
Can I change aggregation on a per-cell basis? That is, I want some cells to start a fresh scope?
The problem with combined compiling are the following:
No aggregation is currently at Application level. It's very easy to otherwise set it up on a cell-level, I just don't know what the interface should be for such configurations. A row of config checkboxes over the editor? A collapsible toolbar? Actually, maybe a form that appears if you click a gears icon.
Can't you do
object Cell1 {
val x = 5
val y = 10
def apply() = x + y
}
object Cell2 {
import Cell1._
val z = y + x + 5
def apply() = z
}
As for the interface, if it was only for defining scopes I would just add a single checkbox/toggle "start a new scope". But I assume there may be more of such properties coming, so yeah, a form makes sense.
The problem is that I can't assume just the last line is the one returning something, i.e.
Map("key1" -> 10,
"key2" -> 100)
So given a String
snippet of code, I have no direct way of figuring out where to insert def apply =
.
Maybe you can use a light-weight scala parser. Not sure if something like the parser from scalariform would work.
For the more complex examples in Wolfe it would be nice to break up scala snippets and interleave them with text. It would be great if I could decide for a given cell whether it starts a new scope, or reuses the one from above. By default we can start new scopes to get the behaviour we currently have.
Several obvious ways come to mind: