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 safe Nix integer warning or compile error #36

Open
PgBiel opened this issue Jan 19, 2025 · 0 comments
Open

Add safe Nix integer warning or compile error #36

PgBiel opened this issue Jan 19, 2025 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers nix target Related to the nix target's codegen upstream-parity Things missing in Glistix compared to the upstream compiler
Milestone

Comments

@PgBiel
Copy link
Member

PgBiel commented Jan 19, 2025

Similarly to how Gleam now warns on unsafe integers on the JS target (see gleam-lang/gleam#3764), we could do the same for Nix since Nix restricts integer literals to between -9223372036854775807 and 9223372036854775808 (signed 64-bit integer values, though to get -9223372036854775808 it is necessary to write -9223372036854775807 - 1).

builtins.fromJSON for higher literals will simply convert to float, whereas, without fromJSON, the literals just cause a parsing error (even if they're not evaluated). It could even straight up become a compilation error.

@PgBiel PgBiel added enhancement New feature or request good first issue Good for newcomers nix target Related to the nix target's codegen upstream-parity Things missing in Glistix compared to the upstream compiler labels Jan 19, 2025
@PgBiel PgBiel added this to the v0.x milestone Jan 19, 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 good first issue Good for newcomers nix target Related to the nix target's codegen upstream-parity Things missing in Glistix compared to the upstream compiler
Projects
None yet
Development

No branches or pull requests

1 participant