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

Added a note to discourage using isize and usize #123

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jhoobergs
Copy link

I ran into an issue when using isize as the pointer length of Wasm is 32 bit and the one of my server is 64 bit.

It seems useful to add this note somewhere in the book, but I might not have found the best place to put it.

Add note on Number sizes
@gbj
Copy link
Contributor

gbj commented Sep 13, 2024

I think this is a reasonable thing to document somewhere, but I don't know that it fits in this intro-level section in the book. I would categorize it as a "once in two years" kind of bug: i.e., this is the first time I've ever heard of someone running into this issue. This doesn't mean it wasn't frustrating, and it doesn't mean it's not worth noting somewhere. Maybe in the docs for the #[server] macro itself, or something like that?

@jhoobergs
Copy link
Author

jhoobergs commented Sep 18, 2024

I agree that it rarely happens. I only found out about it because in one situation, we sent a large number which did not fit in 32 bits, causing an error. However, I do think it is important to put it in the book as in Rust I expect this kind of problems to not occur. It might be interesting to add a last section 'Minor details' (better name needed) which highlights this and maybe some other issues which might happen "once in two years". The goal would be that users remember to look at that section when they encounter something rather vague / strange.

Using isize and usize is by default 'error-prune' in this context, so discouraging it's use does not seem a bad idea.

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