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

Compile-time const values #211

Open
Wodann opened this issue Jun 2, 2020 · 2 comments
Open

Compile-time const values #211

Wodann opened this issue Jun 2, 2020 · 2 comments
Labels
tracking Tracking issue for an epic

Comments

@Wodann
Copy link
Collaborator

Wodann commented Jun 2, 2020

Similar to Rust's const we want to introduce compile-time constants using the const keyword. E.g.:

const UPPER_CAST_CONST: usize = 5;
@Wodann Wodann added the tracking Tracking issue for an epic label Jun 2, 2020
@baszalmstra
Copy link
Collaborator

Some thoughts on the implementation:

  • We can create IR constants that are compiled into the source that uses it
  • We can create a function (or a memory location really) that holds the value of the constant (which can then be patched at will)
  • Type changes also require code changes so that shouldn't be an issue.
  • With the not hotreloading case, we simply create an IR constant.

@baszalmstra
Copy link
Collaborator

baszalmstra commented Jun 2, 2020

A maybe more interesting topic is what we allow as the value of a constant? We don't have anything like constexpr yet.

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

No branches or pull requests

2 participants