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

am I missing the way to return computed values as variable values #162

Open
pm100 opened this issue Jan 3, 2024 · 3 comments · May be fixed by #166
Open

am I missing the way to return computed values as variable values #162

pm100 opened this issue Jan 3, 2024 · 3 comments · May be fixed by #166
Labels
enhancement New feature or request

Comments

@pm100
Copy link

pm100 commented Jan 3, 2024

I would like to expose variables (not functions) to the expressions that are not simple data items but I cannot find a way to do it .

Specifically - I am writing a 6502 emulator debugger. I want to expose the registers as variables in expressions. I can find no way to do it because of this signature:

fn get_value(&self, identifier: &str) -> Option<&Value>;

In the Context trait. It requires me to return a reference to a Value, if the value is looked up or computed in any way I cannot do that. I note that :

fn call_function(&self, identifier: &str, argument: &Value) -> EvalexprResult<Value>

returns the actual value not a reference. It would be a lot simpler if get_value did the same.. Is there some magic trick I am missing

@ISibboI
Copy link
Owner

ISibboI commented Jan 3, 2024

There was #104 that may solve this, but it is outdated and stale. Feel free to make a new one, but I don't have much time to review or merge at the moment.

@ISibboI ISibboI added enhancement New feature or request question Further information is requested and removed question Further information is requested labels Jan 3, 2024
@pm100
Copy link
Author

pm100 commented Jan 4, 2024

I see that bug / PR - two questions

  • why return a Cow, why not a simple value just like call_functions does
  • it seems you dont mind a breaking change, this would require a change to the Context trait

@ISibboI
Copy link
Owner

ISibboI commented Jan 4, 2024 via email

@danieldg danieldg linked a pull request Feb 21, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants