add a way to define static members to circuits to accesses rfc

This commit is contained in:
gluaxspeed 2021-10-21 11:27:02 -07:00
parent 2a7298b873
commit 5654e8a7a6

View File

@ -45,6 +45,15 @@ postfix-expression = primary-expression
/ named-type "::" identifier ; this is new to allow member constants
/ postfix-expression "[" expression "]"
/ postfix-expression "[" [expression] ".." [expression] "]"
; Also need to add a new static member variable declaration rule to allow for static constant members.
static-member-variable-declarations = static identifier ":" type = literal ";"
; We then need to modify the circuit declartion rule.
circuit-declaration = %s"circuit" identifier
"{" [ static-member-variable-declarations ]
[ member-variable-declarations ]
*member-function-declaration "}"
```
Now methods and static members would be first-class citizens of scalar types and their values. For example, the following could be done: