Open tindzk opened 9 years ago
sealed class Var[T](init: => T)
Seems like a better way to handle this since the initial value could be something that could change with each "instance".
what if instead of some strange concept of state you instead deal with these a little differently:
sealed class Var[T](init: => T) {
...
def instantiate: VarInstance[T] = new VarInstance[T](this)
}
class VarInstance[T](var: Var[T]) {
... setup based on content of Var ...
}
Var
,Opt
etc. store the current values internally. This prevents their usage in reusable components. The goal would be to make channels immutable with regards to their state. However, the specified pipeline will still be mutable as it usually doesn't change once set up.Given a web server with multiple users:
The example is contrived, but it shows how the specified data propagation pipeline could be reused across several requests. There are some challenges involved, for example how the state gets passed around.
A tentative sketch would look like this: