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

Adding conditions to the language #15

Open
StrykerKKD opened this issue Feb 8, 2020 · 2 comments
Open

Adding conditions to the language #15

StrykerKKD opened this issue Feb 8, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@StrykerKKD
Copy link
Owner

Variables could have conditions/validations in them, which could be used for expressing conditions like a > 5 or a!=5 or a > b or a!=b. Basically this would be Logical's defacto constraint system and would make it possible to implement negation in this way. (So much for being negation free :D)

A condition in this case would be a function with the following signature:
state -> value_a -> value_b -> state option
This would mean that a condition can remove a state if it thinks that it's faulty and we would run this check during the unify process.

Using two variables in a condition is a little bit tricky, because in this case the two variables must share the condition, because we can't be sure which variable will be the last to get a value a be able to check the conditions.

Another tricky part is that a condition should pass when it can't evaluate the expression, because one or both variables doesn't have a value.

Conditions are the same type wise as unify, so maybe we can make this whole concept more general by making unify into a condition also. Although unify is a very basic building block of the system.

@StrykerKKD StrykerKKD added the enhancement New feature or request label Feb 8, 2020
@StrykerKKD
Copy link
Owner Author

Conditions can help us removing the usage State.value_of, which makes the goal dependent of where it's used, which is something we should avoid.

@StrykerKKD
Copy link
Owner Author

StrykerKKD commented Feb 11, 2020

This issue is basically about creating a constraint system. Right now I can only see two kind of constraint system:

  • Local constraint system that puts the constraints beside the variable in a state
  • Global constraint system that has a separate global store for constraints that is shared by everyone

The proposed one is a local one and I'm thinking of sticking to it for this issue, but I'm keeping the global one in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant