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

Use less strict (compatable) int types for encoding #324

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

MrFoxPro
Copy link
Contributor

@MrFoxPro MrFoxPro commented Apr 23, 2024

Rust by default uses i32 for integers, so, for arguments (especially useful for named) I think we can allow passing i32 as i64, as cast from one to another should be safe.

@MrFoxPro
Copy link
Contributor Author

I also would like to add some debug logs here so user aware for this cast, but as I see edgedb-rsut doesn't produce any logs now, there is no tracing

@MrFoxPro
Copy link
Contributor Author

on rust nighlty build is successful, interesting

@aljazerzen
Copy link
Contributor

This makes sense, because we are not wasting any space: if the query requires int64, we will be sending 64 bits and rejecting the argument only means that the user must correct the argument and gain basically nothing from it.

I'll expand this approach to all types for which this also makes sense.

@MrFoxPro
Copy link
Contributor Author

This makes sense, because we are not wasting any space: if the query requires int64, we will be sending 64 bits and rejecting the argument only means that the user must correct the argument and gain basically nothing from it.

I'll expand this approach to all types for which this also makes sense.

I'm not sure about float casting though

@aljazerzen
Copy link
Contributor

What would be your reason against? As far as I know, all values of f32 are also expressible in f64. So there would never be any change to the semantic value of the float.

@MrFoxPro
Copy link
Contributor Author

What would be your reason against? As far as I know, all values of f32 are also expressible in f64. So there would never be any change to the semantic value of the float.

okay

@aljazerzen aljazerzen merged commit 6b36fa7 into edgedb:master Apr 25, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants