Skip to content

[feature] Support for out parameters #83

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

Closed
olegbevz opened this issue Feb 11, 2021 · 6 comments
Closed

[feature] Support for out parameters #83

olegbevz opened this issue Feb 11, 2021 · 6 comments
Assignees

Comments

@olegbevz
Copy link

Hello, I need to call IDictionary.TryGetValue method in my expression, as I understand out parameters are not supported now.
I've tried to execute following code in TryWindow application:

var dictionary = new Dictionary<string, object>();
dictionary.Add("x", 5);
object number = null;
if (dictionary.TryGetValue("x", out number))
	return number;
return 0;

and have got following message:

Variable [out] unknown in expression : [out number]

Mb I did something wrong?
Are there any plans to support out parameters feature?

@lofcz
Copy link
Contributor

lofcz commented Feb 11, 2021

out along with several other missing keywords are on todo here: https://github.com/codingseb/ExpressionEvaluator/wiki/ExpressionEvaluator-Todo-List

+1 for this, supporting out would be nice.

@codingseb codingseb self-assigned this Feb 11, 2021
@codingseb
Copy link
Owner

Hello @olegbevz.
Thanks for this issue and your interest for ExpressionEvaluator (EE).
Yes as @lofcz said it is on my todo list. So if it a request now, I will put it in my priority list for EE.
Just take note that I have a bit less time for EE these days for personal reasons.
But I will come back to this as soon as I can and will look how to implement out and maybe ref keywords.

@lofcz
Copy link
Contributor

lofcz commented Feb 11, 2021

Thanks @codingseb, hope things are (will be) fine! I think that priority of missing keywords would be out > ref > params > in. Note this is not taking async into account.
I'm also planning to send another 50$ this month as a small token of my gratitude for your work.

@codingseb
Copy link
Owner

@lofcz Thanks, you are awesome.
Things are fine, I just have a bit more stuff to manage than as usual.
I think for a couple of days or weeks.
I will come back as soon as I can.

codingseb added a commit that referenced this issue Feb 19, 2021
@codingseb
Copy link
Owner

I published version 1.4.20.0 that add support for out, ref, in keywords and for calling methods with params parameter.

The implementation is a bit more permissive than in pure C# and also required to modify a bit the way the library search the right override of a method and how it manage parameters to call it. I made a few tests to ensure that the most cases work but if you find some bugs related to this don't hesitate to open new issues.

Thanks guys
I am glad that this will allow a bunch of new stuff with EE.

@lofcz
Copy link
Contributor

lofcz commented Feb 24, 2021

Congratulations, great job @codingseb !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants