Skip to content
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

Stop evaluation of expressions with variables as operations #473

Merged
merged 8 commits into from
Nov 3, 2023

Conversation

vsbogd
Copy link
Collaborator

@vsbogd vsbogd commented Oct 25, 2023

This is fast fix for #242 to unblock PLN work. This code doesn't use pragma! because at the moment pragma! settings are not reachable from the interpreter. More elegant fixes described in the issue could be implemented after migration to the minimal MeTTa.

This is fast fix without pragma! because at the moment pragma! value is
not reachable from the interpreter. More elegant fix could be
implemented in minimal MeTTa.
@vsbogd vsbogd requested review from ngeiswei and Necr0x0Der October 25, 2023 07:36
@Necr0x0Der
Copy link
Collaborator

I'm ok with it if it works for @ngeiswei

@noskill
Copy link
Contributor

noskill commented Oct 25, 2023

i wonder how pln was blocked by matching first variable in an expression

@noskill
Copy link
Contributor

noskill commented Oct 25, 2023

also if the first variable can't be matched we can modify a program by adding dummy symbol:

(= (croaks Fritz) True)

(= (_ croaks Fritz) True)
!(let $res (_ $W Fritz) (if $res $W None))

So does this change actually changes anything?

Copy link
Contributor

@ngeiswei ngeiswei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding a compile-time macro around that code? That way we can postpone the decision of whether to make it the default behavior and give ourselves more time to experiment with/without.

@vsbogd
Copy link
Collaborator Author

vsbogd commented Oct 27, 2023

What do you think about adding a compile-time macro around that code? That way we can postpone the decision of whether to make it the default behavior and give ourselves more time to experiment with/without.

It is easy to do and I can do it. Do you suggest turn old or new behaviour by default?

Anyway I don't think it is a one way ticket and I consider this fix as a fast fix to unblock the PLN. As a proper fix I would like to add some method of control such matching in a MeTTa not event pragma, but custom eval for instance.

@ngeiswei
Copy link
Contributor

Do you suggest turn old or new behaviour by default?

I don't mind either way, as long as the flag is mentioned in the README.md. Maybe old behavior could be the default to minimize disruption for now.

As a proper fix I would like to add some method of control such matching in a MeTTa not event pragma, but custom eval for instance.

👍

@vsbogd vsbogd requested a review from luketpeterson October 30, 2023 12:01
@vsbogd
Copy link
Collaborator Author

vsbogd commented Oct 30, 2023

@ngeiswei , I added switch. @luketpeterson , could you please take a look to ensure REPL also has this feature turned on by default. I believe it is true, but I would ask you to double check.

@luketpeterson
Copy link
Contributor

@ngeiswei , I added switch. @luketpeterson , could you please take a look to ensure REPL also has this feature turned on by default. I believe it is true, but I would ask you to double check.

Because the feature is a default in the top-level lib's Cargo.toml, all downstream dependencies (including repl) get the feature without any explicit change. Disabling a default feature is another story, however. Disagreement on that has been going for 7 years and shows no sign of getting any better. rust-lang/cargo#3126

I don't fully understand the rationale for providing this as a compile-time feature at all. It seems like we should find one behavior that works in all cases, and make whatever changes are needed to the interpreter so that is possible.

@Necr0x0Der
Copy link
Collaborator

I don't fully understand the rationale for providing this as a compile-time feature

It's a hotfix for the blocker right now. That's the rationale.

@luketpeterson
Copy link
Contributor

I don't fully understand the rationale for providing this as a compile-time feature

It's a hotfix for the blocker right now. That's the rationale.

I am not questioning the change itself. You, Vitaly, & Nil have more clarity there.

My observation was that, by making the feature a library default, the set of downstream clients who will get the old behavior is likely to be the empty set. So I wasn't clear on the value of using the Cargo feature mechanism. But not a big deal if it's temporary.

@vsbogd
Copy link
Collaborator Author

vsbogd commented Nov 1, 2023

Well, @ngeiswei requested this to be a compile time feature and he is the main user of the change, so I believe he will use it to unblock his work.

@vsbogd
Copy link
Collaborator Author

vsbogd commented Nov 1, 2023

@ngeiswei , are you ok with current state of the PR?

@ngeiswei
Copy link
Contributor

ngeiswei commented Nov 3, 2023

The set might not be empty cause I might be in it :-) I'd rather have an easy way to switch on/off in case I need to.

I'm happy with the state of the PR.

@vsbogd
Copy link
Collaborator Author

vsbogd commented Nov 3, 2023

I'm happy with the state of the PR.

Ok, I am considering it as an approve :-)

@ngeiswei ngeiswei self-requested a review November 3, 2023 10:14
@Necr0x0Der Necr0x0Der merged commit 5eb2d51 into trueagi-io:main Nov 3, 2023
1 check passed
@vsbogd vsbogd deleted the fix-242 branch January 10, 2024 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants