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

Get non-int64/float64 numeric constants working efficiently #215

Open
dfellis opened this issue Aug 19, 2020 · 2 comments
Open

Get non-int64/float64 numeric constants working efficiently #215

dfellis opened this issue Aug 19, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@dfellis
Copy link
Member

dfellis commented Aug 19, 2020

It is currently actually impossible to define numeric constants other than int64 and float64. First-time usage in another size goes through a conversion function to load the global constant data in a smaller size.

Perhaps steal Rust's 0i8 style postfix annotation to declare them, or have the compiler detect 0.toInt8() as a unit and replace with the smaller constant type.

@dfellis dfellis added the enhancement New feature or request label Nov 11, 2020
@dfellis
Copy link
Member Author

dfellis commented Jun 2, 2024

Thinking about it with the new syntax, if I make built-in functions to work with the Int and Float types directly, I should be able to have it automatically match the type of the other integer or floating point value (or Fail if it is out-of-bounds).

@dfellis
Copy link
Member Author

dfellis commented Jun 2, 2024

How to handle situations like const val = 1 + 2; is the problem. Maybe it just stays the Int type and is figured out based on where it is used, but that would require some sort of "fall back to type operators" logic in the operator parsing logic, which I am not sure if it is a good idea. Would it be too magical? What if the "meaning" of the type operator it falls to doesn't match the function operator?

@dfellis dfellis added this to the v0.2 release milestone Jun 11, 2024
@dfellis dfellis removed this from the v0.2 release milestone Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant