You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function purity annotations were added in #1870 for Stable Cadence, allowing referentially-transparent functions to be annotated as such with the new view keyword.
We currently treat view as a hard keyword, which prevents it from being used as an identifier in any context. This is a problem, as the NFT contracts and many other on-chain contracts use it for arguments and variables, which breaks their code.
Suggested Solution
Make view a soft keyword in identifier position. This will require 1 token of lookahead in the parser when a view token is encountered - if it's followed by fun, then we know we're encountering a view function declaration or expression. Otherwise, it can be treated as an identifier. The list of soft keywords in the Stable Cadence changelog will also need to be updated.
Tasks:
Extend the parser
Update documentation and changelogs
The text was updated successfully, but these errors were encountered:
Issue To Be Solved
Function purity annotations were added in #1870 for Stable Cadence, allowing referentially-transparent functions to be annotated as such with the new
view
keyword.We currently treat
view
as a hard keyword, which prevents it from being used as an identifier in any context. This is a problem, as the NFT contracts and many other on-chain contracts use it for arguments and variables, which breaks their code.Suggested Solution
Make
view
a soft keyword in identifier position. This will require 1 token of lookahead in the parser when aview
token is encountered - if it's followed byfun
, then we know we're encountering a view function declaration or expression. Otherwise, it can be treated as an identifier. The list of soft keywords in the Stable Cadence changelog will also need to be updated.Tasks:
The text was updated successfully, but these errors were encountered: