Unclear SetExpression with parameter behavior
See original GitHub issueHi,
var interpreter = new Interpreter();
var parameter = new Parameter("x", typeof(int));
var expression = interpreter.Parse("x + 1", parameter).Expression;
var lambda = interpreter
.SetExpression("value", expression)
.Parse("value + 1", parameter);
var result = lambda.Invoke(1);
This will throw
System.InvalidOperationException: variable 'x' of type 'System.Int32' referenced from scope '', but it is not defined
Trying to register identifier like below leads to same exception
var lambda = interpreter
.SetExpression("value", expression)
.SetIdentifier(new Identifier("x", parameter.Expression))
.Parse("value + 1", parameter);
And only if I mention the identifier in primary expression interpreter.Parse("x + value + 1", parameter)
will parse with success.
Could you please advise how to propagate x
parameter to internal expression without mentioning it in primary one?
Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
SSRS: Passing/Setting parameter to Dataset using ...
1 Answer. here is no way one can pass parameter within expression. You will need to create a subreport to do this. You...
Read more >Advanced Expressions as Variables
I have been transferring all the expressions that the company uses over to variables that are saved in Excel. Simple ones like this...
Read more >Parameter Declaration and Attributes
The Uncertainty attribute specifies a relationship between the uncertain parameter at hand, and one or more other (uncertain) parameters in your model. The ......
Read more >Column Elements and Expressions — SQLAlchemy 2.0 ...
Produce an column-expression-level unary DISTINCT clause. ... positional argument in order to be valid; a and_() construct with no arguments is ambiguous.
Read more >hail.expr.functions
Parameters ---------- x Object to capture and broadcast as an expression. ... This matches the behavior of Python's ``range``. Parameters ---------- start ...
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
My bad, the parameter simply needs to be the same reference:
I like the proposal, but I think we should be careful so that the public interface remains as close as possible to the existing one so that users just have to recompile, but not have to update their code because it’s always painful.