-
Notifications
You must be signed in to change notification settings - Fork 17
Description
This is not really a bug but an issue i've found while using the implementation in my fork of the 2p-kt repo.
the issue i am going to present can be found in the implementation of gui/src/commonMain/kotlin/it/unibo/tuprolog/ui/gui/impl/PageImpl.kt of branch feature/web-gui.
Background:
Basically, inside of the PageImpl implementation, the theory field getter contains a side effect that allows for theory parsing optimizations. To my understanding, if no updates have been made to the user defined theory, we do not need to parse it again but instead can use the previously parsed one.
Issue:
My point is that this getter may no be the best point where to implement such a logic since outside users may tamper with the optimization logic by simply reading the theory field.
Fixes(?):
I'd like to suggest a different approach:
- explicitly split the optimization flag by effectively calling a separate method
- make the theory field private and force the end users to access the updated theory by using the already implemented observable Page
events (onTheoryChange)