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

More sensible numeric type naming #16

Open
liquidev opened this issue Feb 26, 2022 · 0 comments
Open

More sensible numeric type naming #16

liquidev opened this issue Feb 26, 2022 · 0 comments

Comments

@liquidev
Copy link
Member

The names Uint and Float stem from Weird Things C Did(™) and so I think they should be renamed to more sensible names.

  • Unsigned integers are better called naturals so Uint should be renamed to Nat.
    • The name is abbreviated to 3 letters because it's a common type, just like Int.
    • I've seen this name used in a few places in functional programming languages.
    • It looks much better with all types using PascalCase in the language.
    • Explicit sized versions are Nat8, Nat16, Nat32, Nat64.
  • Floats are better called reals, so Float should be renamed to Real.
    • One opposing thought is that fixed-point numbers exist. Thus we should maybe have Float be renamed to Real as a "sensible default", but not so much sized types Float32 and Float64.

The "unsigned integer" to "natural" change will also make unsigned integers have equal importance as signed integers. Signedness will no longer sound like an opt-out; after all, tsuki treats integers and naturals as completely different types (though implicit widening conversions from naturals to integers may be permitted in the future, as they're fully sound).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant