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 support to inject custom converters #83

Closed
wants to merge 1 commit into from

Conversation

iarly
Copy link

@iarly iarly commented Jul 25, 2018

My expression has integer numbers operating with nullable decimals. In this case, an expression compatibility problem happens when I parse a simple multiplication: x * 100, where x is a nullable decimal parameter.

Then, I needed to extend the conversion behavior to enable custom number conversions that can be passed by the developer through parameters.

After this implementation, I solved my problem writing a custom IntegerConverter in my project. This custom IntegerConverter converts all numbers to decimal.

@davideicardi
Copy link
Member

Thanks @iarly for your merge request, really appreciated.

What happen when writing an expression like this in C#?

When possible I always try to mimic the C# behaviour. So if we can use the same rules I prefer, but eventually adding some extensions should be fine...

Also maybe I prefer to have converters specified using something like interpreter.AddConverters, instead of adding more parameters to the Parse function. What do you think?

@nike61
Copy link

nike61 commented Sep 26, 2018

@iarly check my PR: #89. Maybe it will help you

@davideicardi
Copy link
Member

I will close the PR for inactivity. Feel free to reopen if you still need this PR.

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

Successfully merging this pull request may close these issues.

3 participants