trueagi-io / hyperon-experimental

MeTTa programming language implementation
https://metta-lang.dev
MIT License
153 stars 50 forks source link

Fix unstable minimal test #567

Closed vsbogd closed 9 months ago

vsbogd commented 10 months ago

Main root cause is an inaccurate work with variable bindings. Standard library for minimal interpreter includes a lot of MeTTa code, and thus much more variable bindings are generated during interpretation. Most of these bindings are temporal and should be cleaned up to maximize performance. Inaccurate cleaning up causes different issues in interpreted code. This also causes 50% performance improvement for minimal MeTTa.

This PR fixes:

vsbogd commented 10 months ago

I also investigated why f1_imports.metta fails and found that in trueagi/main it fails because MeTTa part of a standard library is not included into a loading runner instance. In old interpreter it also causes troubles when pure MeTTa functions are called from imported space. These calls are finished incorrectly. In minimal MeTTa the intrepreter itself is defined in MeTTa part of standard library and it leads to the situation when no code in imported space is executed.

vsbogd commented 9 months ago

@luketpeterson, I am merging it as mainly this change touches minimal interpreter and it is more a hotfix. If you have any comments please leave here, I will address them.