Setting Scope for Evaluation
See original GitHub issueIs it possible to set a scope containing all variables for evaluation? Something like this:
Map<String, BigDecimal> scope = new HashMap<>(); // contains values for a and b
scope.put("a", BigDecimal.ZERO);
scope.put("b", BigDecimal.ONE);
Expression ex = new Expression("a+b");
ex.eval(scope);
It would be nice if this wouldn’t mutate the internal state of ex
, so the expression can be used across multiple threads.
Issue Analytics
- State:
- Created 6 years ago
- Comments:23
Top Results From Across the Web
Setting the scope of an evaluation
In setting the scope of an evaluation, you need to consider the purpose, questions, criteria and standards.
Read more >Scope of work | BetterEvaluation
A Scope of Work (SOW) is a plan for conducting an evaluation which outlines the work that is to be performed by the...
Read more >How to Adjust a Rifle Scope in 2022 - Gun University
Adjusting the Scope Forward and Rearward Only after your scope is at the right height, should you worry about the forward/rearward position. Get...
Read more >How To Evaluate a Rifle Scope - OutdoorHub
A good scope has to provide predictable and consistent windage and elevation adjustments.
Read more >Scope - AWS Config
Defines which resources trigger an evaluation for an AWS Config rule. The scope can include one or more resource types, a combination of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just to make it clear, I have no problem with you rejecting any of my changes (especially ones that I started working on without waiting for your reply first).
My thought behind this was that parsing the expression might be something expensive that one only wants to do once and then use that
Expression
instance to run on different values (even on different threads). That is my idea behind this, but I understand what you mean.You are right, we could move all these properties into the
Scope
, but I wouldn’t have done that. It is unlikely that you want to evaluate the same expression with different precisions, but what one might like to do is evaluate it with different values. ReusingExpression
s would also become a lot more explicit (because currently one can only overwrite already added variables) and that theExpression
can be used over multiple threads with ease is a nice feature to have, in my opinion, that is why I wanted to do this at all.Thats what I felt like, too. So I developed a more or less replacement for EvalEx that covers our use-case. I can post it here when I’ve got some spare time.