Skip to content

Implementation Role Feature 22

Max Leuthäuser edited this page Oct 16, 2015 · 3 revisions

Title

Compartments may play roles like objects

Description

Compartments can be seen as entities similar to naturals being able to play roles, as well.

Implementation

Compartment instances in SCROLL are either anonymously instantiated Traits or classes, hence they can play roles like any other object.

E.g.:

val transaction = new Transaction(Currency(10.0, "USD"))
// ...
accForStan play new transaction.Source
accForBrian play new transaction.Target
// ...
transaction play new TransactionRole execute()

Transaction is a Compartment itself and plays the TransactionRole inside the banking compartment.

(From: BankExample.scala)

Additional hints

None.

Clone this wiki locally