-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repl config improvements & cntl-J force-submit #433
Conversation
Adding currently-inactive parameter to configure max length of history
…atch is encountered
Luke I feel that I was not very specific in when I was talking about unification in #425. Or may be you have plan to modify it further. What I mean is that we have two kinds of configuration (1) execution config (type checking in interpreter and similar) and (2) REPL config (color scheme and similar). In 325b8c0 you splitted them on two files which is good. But also you converted (2) into set of As was proposed in #425 I think it is better to represent (2) as a set of |
JIC except the comment above other changes looks good to me. |
Regarding the pragma vs. atom-in-space question, I had a change of heart when I was working with it mainly because a pragma assignment is a simple exclusive key-value binding, where a Specifically I was experimenting with setting the REPL prompt to the number of atoms in the space using MeTTa at runtime, and realizing I either need to clean up the old expression first or I might get the old value when I match (since I was just blindly taking the first match.) So on the atom vs. pragma question: I feel like pragma might be a better fit with what the app wants / needs. Unless there is a more elegant expression in MeTTa with built-in exclusivity. Like the StateAtoms from OpenCogClassic. What do you think? On the segregation between runner (init) and repl config question: do you think it's necessary? We already have a pretty sparse namespace given the REPL params begin with "Repl". I was thinking it makes a lot of sense to keep the MeTTa object's settings as a big bag of configs and use naming conventions to keep them separate. Also, the repl.metta file should never run unless the app enters interactive mode. One slight addendum to the "bag of settings" might be a "tree of settings". This is how many complex apps handle things (Google Chrome, Visual Studio Code, etc.), where each setting has a path from a settings root, and different extensions and features are responsible for the settings under different nodes. |
You probably mean that
in fact means
means that
To me it is a question of a clear border between MeTTa runner and MeTTa REPL. I think they should be decoupled but keeping MeTTa REPL configuration inside MeTTa runner makes them coupled. It is really close to the previous question with REPL is a separate project from the engine it has its own settings like color scheme. It can keep it and modify it absolutely independently from MeTTa runner. To me it is like using MeTTa runner as a HashMap while it is not a HashMap. In other words I would keep in MeTTa runner only settings of MeTTa runner. |
Yes, exactly. The config in practice has only one state, so having the possibility for a nondeterministic value in this case is simply a bug.
I made an attempt at implementing the configs with State atoms, but I found it to be unwieldy (not impossible, but ugly) on account of the fact that an ordinary atom ends up shadowing the For example, one way I kludged it together was like this:
But this seems like it gives the user a lot of opportunities to make a mistake. Maybe I'm missing the straightforward way to use the
I don't exactly understand what flexibility is available in the declaration that isn't available in execution. For example, this works exactly like you would expect:
Are you saying it postpones the resolution of the value from the setup time to the query time? The reason I feel this is a double-edged sword is that I end up caching many of the values to avoid a bunch of MeTTa evaluation in the background. And so I'd end up only resolving them once in some cases. On the other hand, with the execution approach (like If we create a dependency push mechanism in the future then maybe it'll be workable. (ie. a way we can register for updates on changes in a space that affect the way a specific atom will evaluate) But that sounds like a Big job that might not be within the design vision for MeTTa at all.
If we decide a "simple stateful setter" pattern is the best way forward (it's certainly the simplest), a system-wide I think the What do you think? |
The example we have discussed is while we have some default global setting like
But to query the state from the Rust code you will need to use tokenizer in order to parse
Yes, you are right here, it is not very conscious comment from my side.
In fact we may need it as well for implementing other things like JIT compiler or memoization. I agree it is big and we cannot count on it in this task for now.
Yes, we can also implement separate library to manage configurations. For instance implement |
This is an interesting conceptual question. In my mind, a If we choose to lean heavily on the tokenizer, then a clean-looking solution will be to introduce new tokens for every config when initializing the REPL. And the config file will just be:
What do you think? |
This change is implemented in 5306394 if you want to try it out. |
Thanks Luke, lets keep it in a state form before we have better idea. |
Separating repl configs from MeTTa environment configs.
Using Pragmas for repl configs
Loosening pragma value type checking
#425
Adding cntl-J "force-submit" key, and changing behavior of enter key when cursor is in the middle of a line