-
Notifications
You must be signed in to change notification settings - Fork 660
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] Add the static global const to Leo #485
Comments
As discussed with @collinc97 |
This could tie in with having global variables, if they are something we eventually want to have anyways. I.e. variables at the top level, not inside a function. Currently we have what, I believe, works a bit like a global variable, namely @gluax's proposed approach sounds good. Since we recently removed (or will soon remove)
for uniformity with variable definitions inside functions. We could disallow |
Yes, the intention is to support global variables. Adding Personally, I feel okay with allowing the I am also on the fence about the ALL UPPERCASE naming of the constants. In rust a warning is emitted when a |
Adding back to this discussion. @collinc97 right now I have the syntax using I currently have it as allowing both lowercase and uppercase syntax, with no warning being generated on lowercase. I would say its better to keep the uppercase for constants warning to a linter or etc as that's what most languages do(rust is an exception I believe). Furthermore I would like to bring up another point of discussion. If importing another leo file, do we import the global constants? I know some languages do this by default, but couldn't remember if rust does or not. In either case what direction would we like leo to take? |
Small question to the topic. Are we considering Circuit-level static constants? Say, you could have Math circuit with |
@damirka this issue only seems to be adding top level constants for now. I don't think we have a discussion on static const circuit fields, but we can definitely open another feature request for one. I think it would be a good addition to the language. |
@damirka I think that what you propose would be a natural and useful extension of Leo. (Just my vote.) |
Added a feature request here! |
🚀 Feature
The C equivalent of:
#define CNAME value
#define CNAME (expression)
A syntax that creates constants that represent numbers, strings or expressions would be very useful. In its most useful form this would allow the global definition of a constant as in C equivalent: #define CNAME value.
Implementation
Are you willing to open a pull request? (See CONTRIBUTING)
The text was updated successfully, but these errors were encountered: