-
-
Notifications
You must be signed in to change notification settings - Fork 12
Architecture
SCROLL is an embedded method-call interception domain-specific language tailored to the features needed to implement roles and resolve the ambiguities arising with regard to dynamic dispatch. The library approach together with an implementation with Scala was chosen for mainly the following reasons: it allows focusing on role semantics, supports a customizable, dynamic dispatch at runtime, and allows for a terse, flexible representation. No additional tooling (like a custom lexer, parser or compiler) is needed to execute the SCROLL meta-object protocol (MOP). It is purely embedded in the host language, thus uses the standard Scala compiler to generate JVM bytecode. With that, the implementation is reasonable small (around 1400 lines of code) and maintainable. The programming interface with Scala's flexible syntax holds the property of being easily readable, even to inexperienced users. We have taken a layered approach as it can be seen above for designing and implementing SCROLL.
This is the end-user layer, tailored for the instantiation and use of objects with their roles as dynamic extensions forming evolving objects. Role objects, as well as their enclosing compartments, may be instantiated from standard Scala classes, case classes, or traits.
All role-specific features are aggregated into the Compartment trait and its utility traits (e.g., DispatchQuery, RoleConstraints, or RoleGroups). They implement the full interface of SCROLL and are configurable at runtime through concrete instances. Altering their default behavior is viable via subclassing. This layer is targeted to both end-users and library developers.
This layer contains the implementation of the metaclasses Compartment and its helper traits (i.e., the MOP). Especially the dynamic dispatch semantics within the DispatchQuery trait are targeted to be investigated and adapted by library developers.
To handle the actual dispatching on the compound object, this layer contains specifications for the dispatch (SCROLLDispatch, SCROLLDynamic). This unifies their complex semantics into only two interfaces rather than scattering them across many interfaces. This layer should be changed if a library developer wants to change the semantics of the dynamic dispatch within SCROLL.