mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-09-11 05:45:30 +03:00
Merge pull request #1361 from AleoHQ/rfc-scalar-methods
[RFC] Some updates to the RFC for scalar methods.
This commit is contained in:
commit
012770c2c0
@ -6,15 +6,15 @@ The Aleo Team.
|
||||
|
||||
## Status
|
||||
|
||||
DRAFT
|
||||
FINAL
|
||||
|
||||
## Summary
|
||||
|
||||
This RFC proposes two things:
|
||||
This RFC proposes three things:
|
||||
|
||||
1. The scalar types in Leo (integers, fields, etc.) can have static methods.
|
||||
2. The scalar types in Leo (integers, fields, etc.) can have static constants.
|
||||
3. Those values that have a scalar type can have methods directly on them.
|
||||
3. Expressions of scalar type can have instance methods called on them.
|
||||
|
||||
## Motivation
|
||||
|
||||
@ -29,23 +29,20 @@ Firstly we would have to modify both the ABNF and parsing of Leo to allow static
|
||||
The ABNF would look as follows:
|
||||
|
||||
```abnf
|
||||
; This is an existing old rule
|
||||
; This is an existing old rule.
|
||||
scalar-type = boolean-type / arithmetic-type / address-type / character-type
|
||||
|
||||
; This is an existing old rule
|
||||
circuit-type = identifier / self-type
|
||||
|
||||
; Add this rule.
|
||||
named-type = circuit-type / scalar-type ; new rule
|
||||
named-type = identifier / self-type / scalar-type
|
||||
|
||||
; Modify this rule:
|
||||
; Modify this rule.
|
||||
postfix-expression = primary-expression
|
||||
/ postfix-expression "." natural
|
||||
/ postfix-expression "." identifier
|
||||
/ identifier function-arguments
|
||||
/ postfix-expression "." identifier function-arguments
|
||||
/ named-type "::" identifier function-arguments ; this used to be a circuit-type
|
||||
/ named-type "::" identifier ; this is new to allow static members on
|
||||
/ named-type "::" identifier function-arguments ; this used to be identifier-or-self-type
|
||||
/ named-type "::" identifier ; this is new to allow member constants
|
||||
/ postfix-expression "[" expression "]"
|
||||
/ postfix-expression "[" [expression] ".." [expression] "]"
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user