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

[Feature] Support for global variables #2182

Open
tanqiangyes opened this issue Nov 17, 2022 · 3 comments
Open

[Feature] Support for global variables #2182

tanqiangyes opened this issue Nov 17, 2022 · 3 comments
Labels
feature A new feature.

Comments

@tanqiangyes
Copy link

🚀 Feature

Support for global variables to make programs more diverse

Motivation

program global.aleo {
         let  global_address: address;
         let  is_set = bool;
        
        transition deploy(addr: address) -> bool {
              if is_set {
                  return false;
              }
              global_address = addr;
              is_set = true;
          }

          transition change_deploy(addr: address, new_addr: address) -> bool {
                if addr != global_address {
                    return false;
                }
                global_address = new_addr;
            }

         //some other features.
}

As you can see, if global variables are implemented, then when writing a game-like contract, players send their game pledges to the contract deployer, so that no player can raise the pledge privately, and the contract deployer can use zero-knowledge proofs to control the access to the game funds through the application made by the player, which greatly ensures the financial security and fairness of the contract.

Implementation

As it stands now, it may be necessary to modify variable declarations, as well as the internal constructs of the program and the corresponding compiler. This will be a lot of work, but it will be a huge boost to the programming effort.

@tanqiangyes tanqiangyes added the feature A new feature. label Nov 17, 2022
@d0cd
Copy link
Collaborator

d0cd commented Dec 5, 2022

Thank you for the proposal!
We are definitely open to introducing this into the language.
We will need to iron out details of the design and programming model in an ARC.
Here are some relevant links:

@tanqiangyes
Copy link
Author

Thank you for the proposal! We are definitely open to introducing this into the language. We will need to iron out details of the design and programming model in an ARC. Here are some relevant links:

Here is:

@tanqiangyes
Copy link
Author

@d0cd Please review the latest ARC, thanks.

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

No branches or pull requests

2 participants