Interfaces and Overriding in LF Inheritance #1753
Replies: 3 comments
-
Two questions:
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
@edwardalee with respect to 1., I would argue that a sensible reactor interface also includes the dependency information. Only if we know the internal structure of the reactor interface (i.e. we can draw a diagram for it), we can seamlessly exchange implementations without recompilation. I am not sure if we really need virtual inheritance and abstract interfaces in LF though. Reactors are not equivalent to classes in OO languages and we shouldn't confuse the concepts. I see several challenges with supporting reactor interfaces natively in LF. Since reactions contain arbitrary code, the problem could be solved quite as well in the reaction bodies. After all the target languages already have the necessary concepts (well, except for C, but there it can be emulated). For the hash table use case that @mkhubaibumer provided, an (arguably simpler) alternative would be to define the AbstractHashTable interface in the target language and then parameterize the reactor with a concrete object implementing this interface. So the reactor implementation would be fixed and the reactions would call the methods of the interface. By providing concrete implementations of the interfaces when instantiating the reactor, the internal behaviour can be changed. This would have the additional benefit that users implementing the interface do not need to understand the reactor semantics. |
Beta Was this translation helpful? Give feedback.
-
Interface
LF provides the basic semantics and very limited functionality for Inheritance I believe LF can extend the feature set around Inheritance for example Interfaces come to mind to restrict certain patterns.
I believe that interfaces are a required feature as the LF matures. Interface also provides extensive way for the user to develop their own plugins as the inputs and outputs are mandated by the Interface.
Overriding
If Parent Reactor defines reactor for certain trigger, the Child should be able to Override the effect if required and with the named reactions I think Overriding also becomes a viable candidate for expansion.
With the current semantics the user can overwrite the output, however, this does not feel like a good approach to follow.
Beta Was this translation helpful? Give feedback.
All reactions