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

Allow different types of constants in Drasil #3866

Open
B-rando1 opened this issue Jul 22, 2024 · 0 comments
Open

Allow different types of constants in Drasil #3866

B-rando1 opened this issue Jul 22, 2024 · 0 comments

Comments

@B-rando1
Copy link
Collaborator

B-rando1 commented Jul 22, 2024

This is motivated by a discussion started in #2179, and summarized by @balacij's comment.

The core of the issue is that in programs, we call things constant for different reasons:

  • There are some things we call constant because they represent something unchanging. Examples include gravity, database information, etc.
  • There are some things we call constant because the flow of the program doesn't require that they change, so for safety or performance we say that they cannot change. Examples include intermediate calculations, e.g. const double discriminant = b*b - 4*a*c;, as the example @hrzhuang gave.
  • There are other places where the semantics of constant and immutable are less clear - e.g. references, classes, methods.

I don't know when, but it would be good to have more flexibility of expression here. Here are my thoughts for what we need to do to get there:

  • Slow down to do some more research and find a framework to organize our thinking on this.
  • Look at Drasil, how it handles constants and immutable variables. We might only need to change drasil-code and drasil-gool, but it would be worthwhile to look higher than that too, e.g. to see if our chunks encode the information that we need.
  • Start adding and using the necessary new functionality to enable the expressiveness we need.

If this is too much to do at once, we could start by limiting our scope to variables, not worrying yet about references, classes, etc.

@B-rando1 B-rando1 added design Related to the current design of Drasil (not artifacts). artifacts and removed design Related to the current design of Drasil (not artifacts). labels Jul 22, 2024
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