-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add support for custom IntType, FloatType #111
Comments
That is a good idea!
If we set the current types as default, it might even stay backwards
compatible.
…On Sat, 30 Jul 2022, 11.31 Jan Vincent Liwanag, ***@***.***> wrote:
Looking for support for custom IntType, FloatType within an evaluation. In
particular, was hoping to us evalexpr with decimal
<https://crates.io/crates/decimal>.
It would be better to be able to provide these types as type parameters
instead of having rust feature flags enforce the types at compile time.
This way, one evaluation can use say, f64 float type, whereas another
portion can use Decimal float type.
—
Reply to this email directly, view it on GitHub
<#111>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASATXUMS3PGJUA6SUH5OPTVWTR67ANCNFSM55C3VDOA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
As discussed here default types for function traits are not yet possible. Unless there is another means of accomplishing this, adding traits to the existing eval functions would break compatibility. We would either have to create yet another class of eval functions that allow specifying types or just give up on backwards compatibility. |
As described in #122 (comment), a way to work around many issues with custom numeric types is to get rid of the current distinction between integers and floats. Instead, add just one generic number type, which can then distinguish between integers and floats internally. The idea for implementation would roughly be:
Open questions are:
|
Not sure this is a proper proposal here to the problem but one way we could be "faster" to implement things here is to use some "syntax" to differentiate between types. One example of such a way is to use sigils. For example, in Elixir we can write something like: The syntax is simply:
We could make this small syntax uplift and it would be easy to have both Would this be welcome as a contribution? |
Looking for support for custom IntType, FloatType within an evaluation. In particular, was hoping to us evalexpr with decimal.
It would be better to be able to provide these types as type parameters instead of having rust feature flags enforce the types at compile time. This way, one evaluation can use say, f64 float type, whereas another portion can use
Decimal
float type.The text was updated successfully, but these errors were encountered: