eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[evaluator] Support Lazy EvaluationEnvironment #1838

Open eclipse-ocl-bot opened 1 month ago

eclipse-ocl-bot commented 1 month ago

| --- | --- | | Bugzilla Link | 516652 | | Status | NEW | | Importance | P3 normal | | Reported | May 15, 2017 09:51 EDT | | Modified | Jul 06, 2017 05:25 EDT | | Blocks | 509668, 509842 | | See also | 509670 | | Reporter | Ed Willink |

Description

See Bug 509670.

The lazy collection support contribution at M7 had to be withheld because test_parsingDocumentsExample failed. Oops. If a popEvaluationEnvironment occurs while a lazy evaluation is pending a Variable needed by a lazy VariableExp may get lost.

Might fudge it till the next problem by making executor/evaluate eager.

But there is really no avoiding an analysis in the interpreter to determine what can safely be lazy.

Similar to the CG, we need variable definitions to be better realated to the execution context. Perhaps variable lookup should climb the lazy iteration tree, which may need enhancement with management nodes. Is the CG guaranteed not to get an iteration variable out of step?

eclipse-ocl-bot commented 1 month ago

By Ed Willink on Jul 04, 2017 09:43

(In reply to Ed Willink from comment #0)

Perhaps variable lookup should climb the lazy iteration tree, which may need enhancement with management nodes.

Currently variable lookup only knows about the environment, so the iteration tree would need to be in the environment.

The hazard occurs when a popEnvironment occurs with a lazy evaluation pending that has an access to the popped context. The lazy result can be wrapped in a ContextIterator whose next() method repushes/repops the used aspects of the environment for the duration of the lazy next() evaluation. ? what is the CG equivalent ?

eclipse-ocl-bot commented 1 month ago

By Ed Willink on Jul 05, 2017 09:36

(In reply to Ed Willink from comment #1)

The lazy result can be wrapped in a ContextIterator

and invoked in an evaluate() variant for use in five popEnvironment places.

All tests pass (only one failed) but it is hard to write a test for e.g. a let context since lazy evaluation is not easily activated and iterations are eager.

Must get rid of the old code to improve coverage and maintenance load.