cairo icon indicating copy to clipboard operation
cairo copied to clipboard

bug(docs): reserved keywords are not reserved

Open enitrat opened this issue 2 years ago • 6 comments
trafficstars

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:

enitrat avatar May 17 '23 11:05 enitrat

Is this still an issue? If not what is the proposed solution? do we include these as keywords in the parser?

cwkang1998 avatar Oct 03 '23 12:10 cwkang1998

do we include these as keywords in the parser?

👍🏻 This should happen IMO

mkaput avatar Oct 03 '23 12:10 mkaput

I'll draft out a PR for this.

cwkang1998 avatar Oct 04 '23 08:10 cwkang1998

@cwkang1998 i think this section in the docs has been updated since I opened the issue

enitrat avatar Oct 04 '23 08:10 enitrat

@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.

cwkang1998 avatar Oct 04 '23 15:10 cwkang1998

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?

enitrat avatar Oct 05 '23 05:10 enitrat