cairo
cairo copied to clipboard
bug(docs): reserved keywords are not reserved
Bug Report
Cairo version:
Current behavior:
According to the documentation, the following keywords are reserved for future usages:
as
assert
do
dyn
extern
let
macro
mod
move
ref
Self
self
static_assert
static
super
try
typeof
unsafe
where
while
with
yield
as should be moved to "Strict Keywords", and the rest of the keywords are not reserved. It is perfectly possible to create the following program with a variable named, for example, with.
Expected behavior:
Steps to reproduce:
Related code:
fn main() {
let with = 3;
}
Other information:
Is this still an issue? If not what is the proposed solution? do we include these as keywords in the parser?
do we include these as keywords in the parser?
👍🏻 This should happen IMO
I'll draft out a PR for this.
@cwkang1998 i think this section in the docs has been updated since I opened the issue
@cwkang1998 i think this section in the docs has been updated since I opened the issue
Its updated in cairo book: https://book.cairo-lang.org/appendix-01-keywords.html
but not at the site: https://docs.cairo-lang.org/language_constructs/keywords.html
I have not yet tried to use the future reserved keyword as variables yet, but if they are still not restricted then I think restricting them in the compiler would be nice too.
Interesting, it looks like the changes merged in this PR https://github.com/starkware-libs/cairo/pull/4009 have not been reflected in the docs website?