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

Add truncate argument to i64 etc to force user choice, e.g. i64(a, truncate=False) #2055

Open
plajjan opened this issue Jan 6, 2025 · 0 comments
Labels
enhancement New feature or request syntax Related to the Acton language syntax / design

Comments

@plajjan
Copy link
Contributor

plajjan commented Jan 6, 2025

When converting from an int to i64 or some other pair of types where the new type is smaller than the first, we might end up having to handle overflow somehow. We can truncate / wraparound, perhaps there are other options too.

I wonder though, should truncating or similar destructive behavior not be explicit? We could add a truncate: bool=False argument. With it's default behavior of not truncating, we could throw an exception if there are overflowing bits. The user can opt to explicitly set truncate=True, in which case we'll discard whatever bits are overflowing.

@sydow @nordlander WDYT?

@plajjan plajjan added enhancement New feature or request syntax Related to the Acton language syntax / design labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request syntax Related to the Acton language syntax / design
Projects
None yet
Development

No branches or pull requests

1 participant