ZoKrates
ZoKrates copied to clipboard
Use more modern syntax for control flow
Abstract
Introduce a more modern syntax for control flow
Motivation
for do endfor
and if else fi
look a bit outdated.
Specification
This is tbd, but two candidates are:
- indentation based à la python, then for loops are exited by removing one indentation. This is potentially tricky to implement in the current state of our parser
- blocks à la {rust, js, C, ...}. This would be another move away from python, but it's a pretty widespread way to scope things and it seems to be ok to implement (functions and for loops are already treated as scopes)
For if-else, blocks remove the need for fi
, didn't look into the python case yet.
Backwards Compatibility
Very probably a breaking change.
I think the safest route to go is with curly braces as it is widely accepted. Python-like indentation is sometimes annoying (with deeply nested conditionals etc), and its worthiness is still debatable.